home *** CD-ROM | disk | FTP | other *** search
/ Super PC 19 / Super PC 19 (Curso OS-2 y shareware).iso / spc / windows / gplotw / source / term.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-25  |  69.4 KB  |  2,224 lines

  1. #ifndef lint
  2. static char *RCSid = "$Id: term.c%v 3.38.2.127 1993/05/06 00:06:02 woo Exp woo $";
  3. #endif
  4.  
  5.  
  6. /* GNUPLOT - term.c */
  7. /*
  8.  * Copyright (C) 1986 - 1993   Thomas Williams, Colin Kelley
  9.  *
  10.  * Permission to use, copy, and distribute this software and its
  11.  * documentation for any purpose with or without fee is hereby granted, 
  12.  * provided that the above copyright notice appear in all copies and 
  13.  * that both that copyright notice and this permission notice appear 
  14.  * in supporting documentation.
  15.  *
  16.  * Permission to modify the software is granted, but not the right to
  17.  * distribute the modified code.  Modifications are to be distributed 
  18.  * as patches to released version.
  19.  *  
  20.  * This software is provided "as is" without express or implied warranty.
  21.  * 
  22.  *
  23.  * AUTHORS
  24.  * 
  25.  *   Original Software:
  26.  *     Thomas Williams,  Colin Kelley.
  27.  * 
  28.  *   Gnuplot 2.0 additions:
  29.  *       Russell Lang, Dave Kotz, John Campbell.
  30.  *
  31.  *   Gnuplot 3.0 additions:
  32.  *       Gershon Elber and many others.
  33.  * 
  34.  * There is a mailing list for gnuplot users. Note, however, that the
  35.  * newsgroup 
  36.  *    comp.graphics.gnuplot 
  37.  * is identical to the mailing list (they
  38.  * both carry the same set of messages). We prefer that you read the
  39.  * messages through that newsgroup, to subscribing to the mailing list.
  40.  * (If you can read that newsgroup, and are already on the mailing list,
  41.  * please send a message info-gnuplot-request@dartmouth.edu, asking to be
  42.  * removed from the mailing list.)
  43.  *
  44.  * The address for mailing to list members is
  45.  *       info-gnuplot@dartmouth.edu
  46.  * and for mailing administrative requests is 
  47.  *       info-gnuplot-request@dartmouth.edu
  48.  * The mailing list for bug reports is 
  49.  *       bug-gnuplot@dartmouth.edu
  50.  * The list of those interested in beta-test versions is
  51.  *       info-gnuplot-beta@dartmouth.edu
  52.  */
  53.  
  54. #include <stdio.h>
  55. #include <ctype.h>
  56. #include "plot.h"
  57. #include "setshow.h"
  58. #include "term.h"
  59. #include "bitmap.h"
  60. #ifdef NEXT
  61. #include <stdlib.h>
  62. #include "epsviewe.h"
  63. #endif /* NEXT */
  64.  
  65. #ifdef _Windows
  66. #ifdef __MSC__
  67. #include <malloc.h>
  68. #else
  69. #include <alloc.h>
  70. #endif
  71. #endif
  72.  
  73. #if defined(__TURBOC__) && defined(MSDOS)
  74. #ifndef _Windows
  75. #include <dos.h>
  76. #endif
  77. #endif
  78.  
  79. /* for use by all drivers */
  80. #define sign(x) ((x) >= 0 ? 1 : -1)
  81. #define abs(x) ((x) >= 0 ? (x) : -(x))
  82.  
  83. #ifndef max    /* GCC uses inline functions */
  84. #define max(a,b) ((a) > (b) ? (a) : (b))
  85. #endif
  86. #ifndef min
  87. #define min(a,b) ((a) < (b) ? (a) : (b))
  88. #endif
  89.  
  90. TBOOLEAN term_init;            /* true if terminal has been initialized */
  91.  
  92. extern FILE *outfile;
  93. extern char outstr[];
  94. extern TBOOLEAN term_init;
  95. extern int term;
  96. extern float xsize, ysize;
  97.  
  98. extern char input_line[];
  99. extern struct lexical_unit token[];
  100. extern int num_tokens, c_token;
  101. extern struct value *const_express();
  102.  
  103. extern TBOOLEAN interactive;
  104.  
  105. /*
  106.  * instead of <strings.h>
  107.  */
  108.  
  109. #if defined(_Windows) || ( defined(__TURBOC__) && defined(MSDOS) )
  110. # include <string.h>
  111. #else
  112. #ifdef ATARI
  113. #include <string.h>
  114. #include <math.h>
  115. #else
  116. #ifndef AMIGA_SC_6_1
  117. extern char *strcpy();
  118. extern int strlen(), strcmp(), strncmp();
  119. #endif /* !AMIGA_SC_6_1 */
  120. #endif
  121. #endif
  122.  
  123. #ifndef AMIGA_AC_5
  124. extern double sqrt();
  125. #endif
  126.  
  127. char *getenv();
  128.  
  129. #if defined(__TURBOC__) && defined(MSDOS) && !defined(_Windows)
  130. char *turboc_init();
  131. #endif
  132.  
  133. #ifdef __ZTC__
  134. char *ztc_init();
  135. /* #undef TGIF */
  136. #endif
  137.  
  138.  
  139. #if defined(MSDOS)||defined(ATARI)||defined(OS2)||defined(_Windows)||defined(DOS386)
  140. void reopen_binary();
  141. #define REOPEN_BINARY
  142. #endif
  143. #ifdef vms
  144. char *vms_init();
  145. void vms_reset();
  146. void term_mode_tek();
  147. void term_mode_native();
  148. void term_pasthru();
  149. void term_nopasthru();
  150. void reopen_binary();
  151. void fflush_binary();
  152. #define REOPEN_BINARY
  153. #endif
  154.  
  155. /* This is needed because the unixplot library only writes to stdout. */
  156. #ifdef UNIXPLOT
  157. FILE save_stdout;
  158. #endif
  159. int unixplot=0;
  160.  
  161. #define NICE_LINE        0
  162. #define POINT_TYPES        6
  163.  
  164.  
  165. do_point(x,y,number)
  166. int x,y;
  167. int number;
  168. {
  169. register int htic,vtic;
  170. register struct termentry *t = &term_tbl[term];
  171.  
  172.      if (number < 0) {        /* do dot */
  173.         (*t->move)(x,y);
  174.         (*t->vector)(x,y);
  175.         return(0);
  176.     }
  177.  
  178.     number %= POINT_TYPES;
  179.     htic = (t->h_tic/2);    /* should be in term_tbl[] in later version */
  180.     vtic = (t->v_tic/2);    
  181.  
  182.     switch(number) {
  183.         case 0: /* do diamond */ 
  184.                 (*t->move)(x-htic,y);
  185.                 (*t->vector)(x,y-vtic);
  186.                 (*t->vector)(x+htic,y);
  187.                 (*t->vector)(x,y+vtic);
  188.                 (*t->vector)(x-htic,y);
  189.                 (*t->move)(x,y);
  190.                 (*t->vector)(x,y);
  191.                 break;
  192.         case 1: /* do plus */ 
  193.                 (*t->move)(x-htic,y);
  194.                 (*t->vector)(x-htic,y);
  195.                 (*t->vector)(x+htic,y);
  196.                 (*t->move)(x,y-vtic);
  197.                 (*t->vector)(x,y-vtic);
  198.                 (*t->vector)(x,y+vtic);
  199.                 break;
  200.         case 2: /* do box */ 
  201.                 (*t->move)(x-htic,y-vtic);
  202.                 (*t->vector)(x-htic,y-vtic);
  203.                 (*t->vector)(x+htic,y-vtic);
  204.                 (*t->vector)(x+htic,y+vtic);
  205.                 (*t->vector)(x-htic,y+vtic);
  206.                 (*t->vector)(x-htic,y-vtic);
  207.                 (*t->move)(x,y);
  208.                 (*t->vector)(x,y);
  209.                 break;
  210.         case 3: /* do X */ 
  211.                 (*t->move)(x-htic,y-vtic);
  212.                 (*t->vector)(x-htic,y-vtic);
  213.                 (*t->vector)(x+htic,y+vtic);
  214.                 (*t->move)(x-htic,y+vtic);
  215.                 (*t->vector)(x-htic,y+vtic);
  216.                 (*t->vector)(x+htic,y-vtic);
  217.                 break;
  218.         case 4: /* do triangle */ 
  219.                 (*t->move)(x,y+(4*vtic/3));
  220.                 (*t->vector)(x-(4*htic/3),y-(2*vtic/3));
  221.                 (*t->vector)(x+(4*htic/3),y-(2*vtic/3));
  222.                 (*t->vector)(x,y+(4*vtic/3));
  223.                 (*t->move)(x,y);
  224.                 (*t->vector)(x,y);
  225.                 break;
  226.         case 5: /* do star */ 
  227.                 (*t->move)(x-htic,y);
  228.                 (*t->vector)(x-htic,y);
  229.                 (*t->vector)(x+htic,y);
  230.                 (*t->move)(x,y-vtic);
  231.                 (*t->vector)(x,y-vtic);
  232.                 (*t->vector)(x,y+vtic);
  233.                 (*t->move)(x-htic,y-vtic);
  234.                 (*t->vector)(x-htic,y-vtic);
  235.                 (*t->vector)(x+htic,y+vtic);
  236.                 (*t->move)(x-htic,y+vtic);
  237.                 (*t->vector)(x-htic,y+vtic);
  238.                 (*t->vector)(x+htic,y-vtic);
  239.                 break;
  240.     }
  241. }
  242.  
  243.  
  244. /*
  245.  * general point routine
  246.  */
  247. line_and_point(x,y,number)
  248. int x,y,number;
  249. {
  250.     /* temporary(?) kludge to allow terminals with bad linetypes 
  251.         to make nice marks */
  252.  
  253.     (*term_tbl[term].linetype)(NICE_LINE);
  254.     do_point(x,y,number);
  255. }
  256.  
  257. /* 
  258.  * general arrow routine
  259.  */
  260. #define ROOT2 (1.41421)        /* sqrt of 2 */
  261.  
  262. do_arrow(sx, sy, ex, ey, head)
  263.     int sx,sy;            /* start point */
  264.     int ex, ey;            /* end point (point of arrowhead) */
  265.     TBOOLEAN head;
  266. {
  267.     register struct termentry *t = &term_tbl[term];
  268.     int len = (t->h_tic + t->v_tic)/2; /* arrowhead size = avg of tic sizes */
  269.  
  270.     /* draw the line for the arrow. That's easy. */
  271.     (*t->move)(sx, sy);
  272.     (*t->vector)(ex, ey);
  273.  
  274.     if (head) {
  275.     /* now draw the arrow head. */
  276.     /* we put the arrowhead marks at 45 degrees to line */
  277.        if (sx == ex) {
  278.        /* vertical line, special case */
  279.           int delta = ((float)len / ROOT2 + 0.5);
  280.           if (sy < ey)
  281.               delta = -delta;    /* up arrow goes the other way */
  282.           (*t->move)(ex - delta, ey + delta);
  283.           (*t->vector)(ex,ey);
  284.           (*t->vector)(ex + delta, ey + delta);
  285.        } else {
  286.           int dx = sx - ex;
  287.           int dy = sy - ey;
  288.           double coeff = len / sqrt(2.0*((double)dx*(double)dx 
  289.                    + (double)dy*(double)dy));
  290.           int x,y;            /* one endpoint */
  291.  
  292.           x = (int)( ex + (dx + dy) * coeff );
  293.           y = (int)( ey + (dy - dx) * coeff );
  294.           (*t->move)(x,y);
  295.           (*t->vector)(ex,ey);
  296.  
  297.           x = (int)( ex + (dx - dy) * coeff );
  298.           y = (int)( ey + (dy + dx) * coeff );
  299.           (*t->vector)(x,y);
  300.        }
  301.     }
  302. }
  303.  
  304. #ifdef DUMB                    /* paper or glass dumb terminal */
  305. #include "term/dumb.trm"
  306. #endif
  307.  
  308.  
  309. #ifndef _Windows
  310. # ifdef PC            /* all PC types except MS WINDOWS*/
  311. #  include "term/pc.trm"
  312. # endif
  313. #else
  314. #  include "term/win.trm"
  315. #endif
  316.  
  317. #ifdef __ZTC__
  318. #include "term/fg.trm"
  319. #endif
  320.  
  321. #ifdef DJSVGA
  322. #include "term/djsvga.trm"    /* DJGPP SVGA */
  323. #endif
  324.  
  325. #ifdef EMXVGA
  326. #include "term/emxvga.trm"    /* EMX VGA */
  327. #endif
  328.  
  329. #ifdef OS2PM                    /* os/2 presentation manager */
  330. #include "term/pm.trm"
  331. #endif
  332.  
  333. #ifdef ATARI            /* ATARI-ST */
  334. #include "term/atari.trm"
  335. #endif
  336.  
  337. /*
  338.    all TEK types (TEK,BITGRAPH,KERMIT,VTTEK,SELANAR) are ifdef'd in tek.trm,
  339.    but most require various TEK routines.  Hence TEK must be defined for
  340.    the others to compile.
  341. */
  342. #ifdef BITGRAPH
  343. # ifndef TEK
  344. #  define TEK
  345. # endif
  346. #endif
  347.  
  348. #ifdef SELENAR
  349. # ifndef TEK
  350. #  define TEK
  351. # endif
  352. #endif
  353.  
  354. #ifdef KERMIT
  355. # ifndef TEK
  356. #  define TEK
  357. # endif
  358. #endif
  359.  
  360. #ifdef LN03P
  361. # ifndef TEK
  362. #  define TEK
  363. # endif
  364. #endif
  365.  
  366. #ifdef VTTEK
  367. # ifndef TEK
  368. #  define TEK
  369. # endif
  370. #endif
  371.  
  372. #ifdef T410X        /* Tektronix 4106, 4107, 4109 and 420x terminals */
  373. #include "term/t410x.trm"
  374. #endif
  375.  
  376. #ifdef TEK            /* all TEK types, TEK, BBN, SELANAR, KERMIT, VTTEK */
  377. #include "term/tek.trm"
  378. #endif
  379.  
  380. #ifdef EPSONP    /* bit map types, EPSON, NEC, PROPRINTER, STAR Color */
  381. #include "term/epson.trm"
  382. #endif
  383.  
  384. #ifdef HP500C  /* HP 500 deskjet Colour */
  385. #include "term/hp500c.trm"
  386. #endif
  387.  
  388. #ifdef HPLJII        /* HP LaserJet II */
  389. #include "term/hpljii.trm"
  390. #endif
  391.  
  392. #ifdef PCL /* HP LaserJet III in HPGL mode */
  393. #  ifndef HPGL
  394. #    define HPGL
  395. #  endif
  396. #endif
  397.  
  398. #ifdef HPPJ        /* HP PaintJet */
  399. #include "term/hppj.trm"
  400. #endif
  401.  
  402. #ifdef FIG            /* Fig 2.1 Interactive graphics program */
  403. #include "term/fig.trm"
  404. #include "term/bigfig.trm"
  405. #endif
  406.   
  407. #ifdef GPR              /* Apollo Graphics Primitive Resource (fixed-size window) */
  408. #include "term/gpr.trm"
  409. #endif /* GPR */
  410.  
  411. #ifdef GRASS              /* GRASS (geographic info system) monitor */
  412. #include "term/grass.trm"
  413. #endif /* GRASS */
  414.  
  415. #ifdef APOLLO           /* Apollo Graphics Primitive Resource (resizable window) */
  416. #include "term/apollo.trm"
  417. #endif /* APOLLO */
  418.  
  419. #ifdef IMAGEN        /* IMAGEN printer */
  420. #include "term/imagen.trm"
  421. #endif
  422.  
  423. #ifdef MIF            /* Framemaker MIF  driver */
  424. #include "term/mif.trm"
  425. #endif
  426.  
  427. #ifdef MF            /* METAFONT driver */
  428. #include "term/metafont.trm"
  429. #endif
  430.  
  431. #ifdef TEXDRAW
  432. #include "term/texdraw.trm"
  433. #endif
  434.  
  435. #ifdef EEPIC        /* EEPIC (LATEX) type */
  436. #include "term/eepic.trm"
  437. # ifndef LATEX
  438. #  define LATEX
  439. # endif
  440. #endif
  441.  
  442. #ifdef EMTEX        /* EMTEX (LATEX for PC) type */
  443. # ifndef LATEX
  444. #  define LATEX
  445. # endif
  446. #endif
  447.  
  448. #ifdef LATEX        /* LATEX type */
  449. #include "term/latex.trm"
  450. #endif
  451.  
  452. #ifdef GPIC        /* GPIC (groff) type */ 
  453. #include "term/gpic.trm"
  454. #endif
  455.  
  456. #ifdef PBM        /* PBMPLUS portable bitmap */
  457. #include "term/pbm.trm"
  458. #endif
  459.  
  460. #ifdef POSTSCRIPT    /* POSTSCRIPT type */
  461. #include "term/post.trm"
  462. #endif
  463.  
  464. #ifdef PRESCRIBE    /* PRESCRIBE type */
  465. #include "term/kyo.trm"
  466. #endif
  467.  
  468. /* note: this must come after term/post.trm */
  469. #ifdef PSLATEX        /* LaTeX with embedded PostScript */
  470. #include "term/pslatex.trm"
  471. #endif
  472.  
  473. #ifdef PSTRICKS
  474. #include "term/pstricks.trm"
  475. #endif
  476.  
  477. #ifdef TPIC        /* TPIC (LATEX) type */
  478. #include "term/tpic.trm"
  479. # ifndef LATEX
  480. #  define LATEX
  481. # endif
  482. #endif
  483.  
  484. #ifdef UNIXPC     /* unix-PC  ATT 7300 or 3b1 machine */
  485. #include "term/unixpc.trm"
  486. #endif /* UNIXPC */
  487.  
  488. #ifdef AED
  489. #include "term/aed.trm"
  490. #endif /* AED */
  491.  
  492. #ifdef AIFM
  493. #include "term/ai.trm"
  494. #endif /* AIFM */
  495.  
  496. #ifdef COREL
  497. #include "term/corel.trm"
  498. #endif /* COREL */
  499.  
  500. #ifdef CGI
  501. #include "term/cgi.trm"
  502. #endif /* CGI */
  503.  
  504. #ifdef DEBUG
  505. #include "term/debug.trm"
  506. #endif /* DEBUG */
  507.  
  508. #ifdef EXCL
  509. #include "term/excl.trm"
  510. #endif /* EXCL */
  511.  
  512. #ifdef HP2648
  513. /* also works for HP2647 */
  514. #include "term/hp2648.trm"
  515. #endif /* HP2648 */
  516.  
  517. #ifdef HP26
  518. #include "term/hp26.trm"
  519. #endif /* HP26 */
  520.  
  521. #ifdef HP75
  522. #ifndef HPGL
  523. #define HPGL
  524. #endif
  525. #endif
  526.  
  527. /* HPGL - includes HP75 and HPLJIII in HPGL mode */
  528. #ifdef HPGL
  529. #include "term/hpgl.trm"
  530. #endif /* HPGL */
  531.  
  532. /* Roland DXY800A plotter driver by Martin Yii, eln557h@monu3.OZ 
  533.     and Russell Lang, rjl@monu1.cc.monash.oz */
  534. #ifdef DXY800A
  535. #include "term/dxy.trm"
  536. #endif /* DXY800A */
  537.  
  538. #ifdef IRIS4D
  539. #include "term/iris4d.trm"
  540. #endif /* IRIS4D */
  541.  
  542. #ifdef NEXT
  543. #include "term/next.trm"
  544. #endif /* NEXT */
  545.  
  546. #ifdef QMS
  547. #include "term/qms.trm"
  548. #endif /* QMS */
  549.  
  550. #ifdef REGIS
  551. #include "term/regis.trm"
  552. #endif /* REGIS */
  553.  
  554. #ifdef RGIP
  555. #include "term/rgip.trm"
  556. #endif /* RGIP UNIPLEX */
  557.  
  558. #ifdef SUN
  559. #include "term/sun.trm"
  560. #endif /* SUN */
  561.  
  562. #ifdef VWS
  563. #include "term/vws.trm"
  564. #endif /* VWS */
  565.  
  566. #ifdef V384
  567. #include "term/v384.trm"
  568. #endif /* V384 */
  569.  
  570. #ifdef TGIF
  571. #include "term/tgif.trm"
  572. #endif /* TGIF */
  573.  
  574. #ifdef UNIXPLOT
  575. #ifdef GNUGRAPH
  576. #include "term/gnugraph.trm"
  577. #else
  578. #include "term/unixplot.trm"
  579. #endif /* GNUGRAPH */
  580. #endif /* UNIXPLOT */
  581.  
  582. #ifdef X11
  583. #include "term/x11.trm"
  584. #include "term/xlib.trm"
  585. #endif /* X11 */
  586.  
  587. #ifdef DXF
  588. #include "term/dxf.trm"
  589. #endif /* DXF */
  590.   
  591. #ifdef AMIGASCREEN
  592. #include "term/amiga.trm"
  593. #endif /* AMIGASCREEN */
  594.  
  595. /* Dummy functions for unavailable features */
  596.  
  597. /* change angle of text.  0 is horizontal left to right.
  598. * 1 is vertical bottom to top (90 deg rotate)  
  599. */
  600. static int null_text_angle()
  601. {
  602. return FALSE ;    /* can't be done */
  603. }
  604.  
  605. /* change justification of text.  
  606.  * modes are LEFT (flush left), CENTRE (centred), RIGHT (flush right)
  607.  */
  608. static int null_justify_text()
  609. {
  610. return FALSE ;    /* can't be done */
  611. }
  612.  
  613.  
  614. /* Change scale of plot.
  615.  * Parameters are x,y scaling factors for this plot.
  616.  * Some terminals (eg latex) need to do scaling themselves.
  617.  */
  618. static int null_scale()
  619. {
  620. return FALSE ;    /* can't be done */
  621. }
  622.  
  623. static int do_scale()
  624. {
  625. return TRUE ;    /* can be done */
  626. }
  627.  
  628. options_null()
  629. {
  630.     term_options[0] = '\0';    /* we have no options */
  631. }
  632.  
  633. static UNKNOWN_null()
  634. {
  635. }
  636.  
  637. /*
  638.  * term_tbl[] contains an entry for each terminal.  "unknown" must be the
  639.  *   first, since term is initialized to 0.
  640.  */
  641. struct termentry term_tbl[] = {
  642.     {"unknown", "Unknown terminal type - not a plotting device",
  643.       100, 100, 1, 1,
  644.       1, 1, options_null, UNKNOWN_null, UNKNOWN_null, 
  645.       UNKNOWN_null, null_scale, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null, 
  646.       UNKNOWN_null, UNKNOWN_null, null_text_angle, 
  647.       null_justify_text, UNKNOWN_null, UNKNOWN_null}
  648.  
  649.     ,{"table", "Dump ASCII table of X Y [Z] values to output",
  650.       100, 100, 1, 1,
  651.       1, 1, options_null, UNKNOWN_null, UNKNOWN_null, 
  652.       UNKNOWN_null, null_scale, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null, 
  653.       UNKNOWN_null, UNKNOWN_null, null_text_angle, 
  654.       null_justify_text, UNKNOWN_null, UNKNOWN_null}
  655.  
  656. #ifdef AMIGASCREEN
  657.     ,{"amiga", "Amiga Custom Screen",
  658.        AMIGA_XMAX, AMIGA_YMAX, AMIGA_VCHAR, AMIGA_HCHAR, 
  659.        AMIGA_VTIC, AMIGA_HTIC, options_null, AMIGA_init, AMIGA_reset, 
  660.        AMIGA_text, null_scale, AMIGA_graphics, AMIGA_move, AMIGA_vector,
  661.        AMIGA_linetype, AMIGA_put_text, null_text_angle, 
  662.        AMIGA_justify_text, do_point, do_arrow}
  663. #endif
  664.  
  665. #ifdef ATARI
  666.     ,{"atari", "Atari ST/TT",
  667.        ATARI_XMAX, ATARI_YMAX, ATARI_VCHAR, ATARI_HCHAR, 
  668.        ATARI_VTIC, ATARI_HTIC, ATARI_options, ATARI_init, ATARI_reset, 
  669.        ATARI_text, null_scale, ATARI_graphics, ATARI_move, ATARI_vector, 
  670.        ATARI_linetype, ATARI_put_text, ATARI_text_angle, 
  671.        null_justify_text, ATARI_point, do_arrow}
  672. #endif
  673.  
  674. #ifdef DUMB
  675.     ,{"dumb", "printer or glass dumb terminal",
  676.          DUMB_XMAX, DUMB_YMAX, 1, 1,
  677.          1, 1, DUMB_options, DUMB_init, DUMB_reset,
  678.          DUMB_text, null_scale, DUMB_graphics, DUMB_move, DUMB_vector,
  679.          DUMB_linetype, DUMB_put_text, null_text_angle,
  680.          null_justify_text, DUMB_point, DUMB_arrow}
  681. #endif
  682.  
  683. #ifdef PC
  684. #ifndef _Windows
  685. # ifdef __TURBOC__
  686. #ifdef ATT6300
  687.     ,{"att", "IBM PC/Clone with AT&T 6300 graphics board",
  688.        ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
  689.        ATT_VTIC, ATT_HTIC, options_null, ATT_init, ATT_reset,
  690.        ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
  691.        ATT_linetype, ATT_put_text, ATT_text_angle, 
  692.        ATT_justify_text, line_and_point, do_arrow}
  693. #endif
  694.  
  695.     ,{"cga", "IBM PC/Clone with CGA graphics board",
  696.        CGA_XMAX, CGA_YMAX, CGA_VCHAR, CGA_HCHAR,
  697.        CGA_VTIC, CGA_HTIC, options_null, CGA_init, CGA_reset,
  698.        CGA_text, null_scale, CGA_graphics, CGA_move, CGA_vector,
  699.        CGA_linetype, CGA_put_text, MCGA_text_angle, 
  700.        CGA_justify_text, line_and_point, do_arrow}
  701.  
  702.     ,{"egalib", "IBM PC/Clone with EGA graphics board",
  703.        EGALIB_XMAX, EGALIB_YMAX, EGALIB_VCHAR, EGALIB_HCHAR,
  704.        EGALIB_VTIC, EGALIB_HTIC, options_null, EGALIB_init, EGALIB_reset,
  705.        EGALIB_text, null_scale, EGALIB_graphics, EGALIB_move, EGALIB_vector,
  706.        EGALIB_linetype, EGALIB_put_text, EGALIB_text_angle, 
  707.        EGALIB_justify_text, do_point, do_arrow}
  708.  
  709.     ,{"hercules", "IBM PC/Clone with Hercules graphics board",
  710.        HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
  711.        HERC_VTIC, HERC_HTIC, options_null, HERC_init, HERC_reset,
  712.        HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
  713.        HERC_linetype, HERC_put_text, MCGA_text_angle, 
  714.        HERC_justify_text, line_and_point, do_arrow}
  715.  
  716.     ,{"mcga", "IBM PC/Clone with MCGA graphics board",
  717.        MCGA_XMAX, MCGA_YMAX, MCGA_VCHAR, MCGA_HCHAR,
  718.        MCGA_VTIC, MCGA_HTIC, options_null, MCGA_init, MCGA_reset,
  719.        MCGA_text, null_scale, MCGA_graphics, MCGA_move, MCGA_vector,
  720.        MCGA_linetype, MCGA_put_text, MCGA_text_angle, 
  721.        MCGA_justify_text, line_and_point, do_arrow}
  722.  
  723.     ,{"svga", "IBM PC/Clone with Super VGA graphics board",
  724.        SVGA_XMAX, SVGA_YMAX, SVGA_VCHAR, SVGA_HCHAR,
  725.        SVGA_VTIC, SVGA_HTIC, options_null, SVGA_init, SVGA_reset,
  726.        SVGA_text, null_scale, SVGA_graphics, SVGA_move, SVGA_vector,
  727.        SVGA_linetype, SVGA_put_text, SVGA_text_angle, 
  728.        SVGA_justify_text, do_point, do_arrow}
  729.  
  730.     ,{"vgalib", "IBM PC/Clone with VGA graphics board",
  731.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  732.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  733.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  734.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  735.        VGA_justify_text, do_point, do_arrow}
  736.  
  737.     ,{"vgamono", "IBM PC/Clone with VGA Monochrome graphics board",
  738.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  739.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  740.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  741.        VGAMONO_linetype, VGA_put_text, VGA_text_angle, 
  742.        VGA_justify_text, line_and_point, do_arrow}
  743. #else                    /* TURBO */
  744.  
  745. #ifdef ATT6300
  746.     ,{"att", "AT&T PC/6300 graphics",
  747.        ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
  748.        ATT_VTIC, ATT_HTIC, options_null, ATT_init, ATT_reset,
  749.        ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
  750.        ATT_linetype, ATT_put_text, ATT_text_angle, 
  751.        null_justify_text, line_and_point, do_arrow}
  752. #endif
  753.  
  754.     ,{"cga", "IBM PC/Clone with CGA graphics board",
  755.        CGA_XMAX, CGA_YMAX, CGA_VCHAR, CGA_HCHAR,
  756.        CGA_VTIC, CGA_HTIC, options_null, CGA_init, CGA_reset,
  757.        CGA_text, null_scale, CGA_graphics, CGA_move, CGA_vector,
  758.        CGA_linetype, CGA_put_text, CGA_text_angle, 
  759.        null_justify_text, line_and_point, do_arrow}
  760.  
  761. #ifdef CORONA
  762.     ,{"corona325", "Corona graphics ???",
  763.        COR_XMAX, COR_YMAX, COR_VCHAR, COR_HCHAR,
  764.        COR_VTIC, COR_HTIC, options_null, COR_init, COR_reset,
  765.        COR_text, null_scale, COR_graphics, COR_move, COR_vector,
  766.        COR_linetype, COR_put_text, COR_text_angle, 
  767.        null_justify_text, line_and_point, do_arrow}
  768. #endif                    /* CORONA */
  769.  
  770.     ,{"egabios", "IBM PC/Clone with EGA graphics board (BIOS)",
  771.        EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
  772.        EGA_VTIC, EGA_HTIC, options_null, EGA_init, EGA_reset,
  773.        EGA_text, null_scale, EGA_graphics, EGA_move, EGA_vector,
  774.        EGA_linetype, EGA_put_text, EGA_text_angle, 
  775.        null_justify_text, do_point, do_arrow}
  776.  
  777. #ifdef EGALIB
  778.     ,{"egalib", "IBM PC/Clone with EGA graphics board (LIB)",
  779.        EGALIB_XMAX, EGALIB_YMAX, EGALIB_VCHAR, EGALIB_HCHAR,
  780.        EGALIB_VTIC, EGALIB_HTIC, options_null, EGALIB_init, EGALIB_reset,
  781.        EGALIB_text, null_scale, EGALIB_graphics, EGALIB_move, EGALIB_vector,
  782.        EGALIB_linetype, EGALIB_put_text, null_text_angle, 
  783.        null_justify_text, do_point, do_arrow}
  784. #endif
  785.  
  786. #ifdef HERCULES
  787.     ,{"hercules", "IBM PC/Clone with Hercules graphics board",
  788.        HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
  789.        HERC_VTIC, HERC_HTIC, options_null, HERC_init, HERC_reset,
  790.        HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
  791.        HERC_linetype, HERC_put_text, HERC_text_angle, 
  792.        null_justify_text, line_and_point, do_arrow}
  793. #endif                    /* HERCULES */
  794.  
  795.     ,{"vgabios", "IBM PC/Clone with VGA graphics board (BIOS)",
  796.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  797.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  798.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  799.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  800.        null_justify_text, do_point, do_arrow}
  801.  
  802. #endif                    /* TURBO */
  803. #endif                    /* _Windows */
  804. #endif                    /* PC */
  805.  
  806. #ifdef __ZTC__         /* zortech C flashgraphics for 386 */
  807.     ,{"hercules", "IBM PC/Clone with Hercules graphics board",
  808.        HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
  809.        HERC_VTIC, HERC_HTIC, options_null, VGA_init, VGA_reset,
  810.        VGA_text, null_scale, HERC_graphics, VGA_move, VGA_vector,
  811.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  812.        VGA_justify_text, do_point, do_arrow}
  813.  
  814.     ,{"egamono", "IBM PC/Clone with monochrome EGA graphics board",
  815.        EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
  816.        EGA_VTIC, EGA_HTIC, options_null, VGA_init, VGA_reset,
  817.        VGA_text, null_scale, EGAMONO_graphics, VGA_move, VGA_vector,
  818.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  819.        VGA_justify_text, do_point, do_arrow}
  820.  
  821.     ,{"egalib", "IBM PC/Clone with color EGA graphics board",
  822.        EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
  823.        EGA_VTIC, EGA_HTIC, options_null, VGA_init, VGA_reset,
  824.        VGA_text, null_scale, EGA_graphics, VGA_move, VGA_vector,
  825.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  826.        VGA_justify_text, do_point, do_arrow}
  827.  
  828.     ,{"vgalib", "IBM PC/Clone with VGA graphics board",
  829.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  830.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  831.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  832.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  833.        VGA_justify_text, do_point, do_arrow}
  834.  
  835.     ,{"vgamono", "IBM PC/Clone with monochrome VGA graphics board",
  836.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  837.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  838.        VGA_text, null_scale, VGAMONO_graphics, VGA_move, VGA_vector,
  839.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  840.        VGA_justify_text, do_point, do_arrow}
  841.  
  842.     ,{"svgalib", "IBM PC/Clone with VESA Super VGA graphics board",
  843.        SVGA_XMAX, SVGA_YMAX, SVGA_VCHAR, SVGA_HCHAR,
  844.        SVGA_VTIC, SVGA_HTIC, options_null, VGA_init, VGA_reset,
  845.        VGA_text, null_scale, SVGA_graphics, VGA_move, VGA_vector,
  846.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  847.        VGA_justify_text, do_point, do_arrow}
  848.  
  849.     ,{"ssvgalib", "IBM PC/Clone with VESA 256 color 1024 by 768 super VGA",
  850.        SSVGA_XMAX, SSVGA_YMAX, SSVGA_VCHAR, SSVGA_HCHAR,
  851.        SSVGA_VTIC, SSVGA_HTIC, options_null, VGA_init, VGA_reset,
  852.        VGA_text, null_scale, SSVGA_graphics, VGA_move, VGA_vector,
  853.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  854.        VGA_justify_text, do_point, do_arrow}
  855. #endif    /* __ZTC__ */
  856.  
  857. #ifdef AED
  858.     ,{"aed512", "AED 512 Terminal",
  859.        AED5_XMAX, AED_YMAX, AED_VCHAR, AED_HCHAR,
  860.        AED_VTIC, AED_HTIC, options_null, AED_init, AED_reset, 
  861.        AED_text, null_scale, AED_graphics, AED_move, AED_vector, 
  862.        AED_linetype, AED_put_text, null_text_angle, 
  863.        null_justify_text, do_point, do_arrow}
  864.     ,{"aed767", "AED 767 Terminal",
  865.        AED_XMAX, AED_YMAX, AED_VCHAR, AED_HCHAR,
  866.        AED_VTIC, AED_HTIC, options_null, AED_init, AED_reset, 
  867.        AED_text, null_scale, AED_graphics, AED_move, AED_vector, 
  868.        AED_linetype, AED_put_text, null_text_angle, 
  869.        null_justify_text, do_point, do_arrow}
  870. #endif
  871.  
  872. #ifdef AIFM
  873.     ,{"aifm", "Adobe Illustrator 3.0 Format",
  874.        AI_XMAX, AI_YMAX, AI_VCHAR, AI_HCHAR, 
  875.        AI_VTIC, AI_HTIC, AI_options, AI_init, AI_reset, 
  876.        AI_text, null_scale, AI_graphics, AI_move, AI_vector, 
  877.        AI_linetype, AI_put_text, AI_text_angle, 
  878.        AI_justify_text, do_point, do_arrow}
  879. #endif
  880.  
  881. #ifdef APOLLO
  882.        ,{"apollo", "Apollo Graphics Primitive Resource, rescaling of subsequent plots after window resizing",
  883.        0, 0, 0, 0, /* APOLLO_XMAX, APOLLO_YMAX, APOLLO_VCHAR, APOLLO_HCHAR, are filled in at run-time */
  884.        APOLLO_VTIC, APOLLO_HTIC, options_null, APOLLO_init, APOLLO_reset,
  885.        APOLLO_text, null_scale, APOLLO_graphics, APOLLO_move, APOLLO_vector,
  886.        APOLLO_linetype, APOLLO_put_text, APOLLO_text_angle,
  887.        APOLLO_justify_text, line_and_point, do_arrow}
  888. #endif
  889.  
  890. #ifdef GPR
  891.        ,{"gpr", "Apollo Graphics Primitive Resource, fixed-size window",
  892.        GPR_XMAX, GPR_YMAX, GPR_VCHAR, GPR_HCHAR,
  893.        GPR_VTIC, GPR_HTIC, options_null, GPR_init, GPR_reset,
  894.        GPR_text, null_scale, GPR_graphics, GPR_move, GPR_vector,
  895.        GPR_linetype, GPR_put_text, GPR_text_angle,
  896.        GPR_justify_text, line_and_point, do_arrow}
  897. #endif
  898.  
  899. #ifdef BITGRAPH
  900.     ,{"bitgraph", "BBN Bitgraph Terminal",
  901.        BG_XMAX,BG_YMAX,BG_VCHAR, BG_HCHAR, 
  902.        BG_VTIC, BG_HTIC, options_null, BG_init, BG_reset, 
  903.        BG_text, null_scale, BG_graphics, BG_move, BG_vector,
  904.        BG_linetype, BG_put_text, null_text_angle, 
  905.        null_justify_text, line_and_point, do_arrow}
  906. #endif
  907.  
  908. #ifdef COREL
  909.     ,{"corel","EPS format for CorelDRAW",
  910.      CORELD_XMAX, CORELD_YMAX, CORELD_VCHAR, CORELD_HCHAR,
  911.      CORELD_VTIC, CORELD_HTIC, COREL_options, COREL_init, COREL_reset,
  912.      COREL_text, null_scale, COREL_graphics, COREL_move, COREL_vector,
  913.      COREL_linetype, COREL_put_text, COREL_text_angle,
  914.      COREL_justify_text, do_point, do_arrow}
  915. #endif
  916.  
  917. #ifdef CGI
  918.     ,{"cgi", "SCO CGI drivers (requires CGIDISP or CGIPRNT env variable)",
  919.        CGI_XMAX, CGI_YMAX, 0, 0, 
  920.        CGI_VTIC, 0, options_null, CGI_init, CGI_reset, 
  921.        CGI_text, null_scale, CGI_graphics, CGI_move, CGI_vector, 
  922.        CGI_linetype, CGI_put_text, CGI_text_angle, 
  923.        CGI_justify_text, CGI_point, do_arrow}
  924.  
  925.     ,{"hcgi", "SCO CGI drivers (hardcopy, requires CGIPRNT env variable)",
  926.        CGI_XMAX, CGI_YMAX, 0, 0, 
  927.        CGI_VTIC, 0, options_null, HCGI_init, CGI_reset, 
  928.        CGI_text, null_scale, CGI_graphics, CGI_move, CGI_vector, 
  929.        CGI_linetype, CGI_put_text, CGI_text_angle, 
  930.        CGI_justify_text, CGI_point, do_arrow}
  931. #endif
  932.  
  933. #ifdef DEBUG
  934.     ,{"debug", "debugging driver",
  935.        DEBUG_XMAX, DEBUG_YMAX, DEBUG_VCHAR, DEBUG_HCHAR,
  936.        DEBUG_VTIC, DEBUG_HTIC, options_null, DEBUG_init, DEBUG_reset,
  937.        DEBUG_text, null_scale, DEBUG_graphics, DEBUG_move, DEBUG_vector,
  938.        DEBUG_linetype, DEBUG_put_text, null_text_angle, 
  939.        DEBUG_justify_text, line_and_point, do_arrow}
  940. #endif
  941.  
  942. #ifdef DJSVGA
  943.     ,{"svga", "IBM PC/Clone with Super VGA graphics board",
  944.        DJSVGA_XMAX, DJSVGA_YMAX, DJSVGA_VCHAR, DJSVGA_HCHAR,
  945.        DJSVGA_VTIC, DJSVGA_HTIC, options_null, DJSVGA_init, DJSVGA_reset,
  946.        DJSVGA_text, null_scale, DJSVGA_graphics, DJSVGA_move, DJSVGA_vector,
  947.        DJSVGA_linetype, DJSVGA_put_text, null_text_angle, 
  948.        null_justify_text, do_point, do_arrow}
  949. #endif
  950.  
  951. #ifdef DXF
  952.     ,{"dxf", "dxf-file for AutoCad (default size 120x80)",
  953.        DXF_XMAX,DXF_YMAX,DXF_VCHAR, DXF_HCHAR,
  954.        DXF_VTIC, DXF_HTIC, options_null,DXF_init, DXF_reset,
  955.        DXF_text, null_scale, DXF_graphics, DXF_move, DXF_vector,
  956.        DXF_linetype, DXF_put_text, DXF_text_angle,
  957.        DXF_justify_text, do_point, do_arrow}
  958. #endif
  959.  
  960. #ifdef DXY800A
  961.     ,{"dxy800a", "Roland DXY800A plotter",
  962.        DXY_XMAX, DXY_YMAX, DXY_VCHAR, DXY_HCHAR,
  963.        DXY_VTIC, DXY_HTIC, options_null, DXY_init, DXY_reset,
  964.        DXY_text, null_scale, DXY_graphics, DXY_move, DXY_vector,
  965.        DXY_linetype, DXY_put_text, DXY_text_angle, 
  966.        null_justify_text, do_point, do_arrow}
  967. #endif
  968.  
  969. #ifdef EEPIC
  970.     ,{"eepic", "EEPIC -- extended LaTeX picture environment",
  971.        EEPIC_XMAX, EEPIC_YMAX, EEPIC_VCHAR, EEPIC_HCHAR, 
  972.        EEPIC_VTIC, EEPIC_HTIC, options_null, EEPIC_init, EEPIC_reset, 
  973.        EEPIC_text, EEPIC_scale, EEPIC_graphics, EEPIC_move, EEPIC_vector, 
  974.        EEPIC_linetype, EEPIC_put_text, EEPIC_text_angle, 
  975.        EEPIC_justify_text, EEPIC_point, EEPIC_arrow}
  976. #endif
  977.  
  978. #ifdef EMTEX
  979.     ,{"emtex", "LaTeX picture environment with emTeX specials",
  980.        LATEX_XMAX, LATEX_YMAX, LATEX_VCHAR, LATEX_HCHAR, 
  981.        LATEX_VTIC, LATEX_HTIC, LATEX_options, EMTEX_init, EMTEX_reset, 
  982.        EMTEX_text, LATEX_scale, LATEX_graphics, LATEX_move, LATEX_vector, 
  983.        LATEX_linetype, LATEX_put_text, LATEX_text_angle, 
  984.        LATEX_justify_text, LATEX_point, LATEX_arrow}
  985. #endif
  986.  
  987. #ifdef EPS180
  988.     ,{"epson_180dpi", "Epson LQ-style 180-dot per inch (24 pin) printers",
  989.        EPS180XMAX, EPS180YMAX, EPSON180VCHAR, EPSON180HCHAR,
  990.        EPSON180VTIC, EPSON180HTIC, options_null, EPSONinit, EPSONreset,
  991.        EPS180text, null_scale, EPS180graphics, EPSONmove, EPSONvector,
  992.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  993.        null_justify_text, do_point, do_arrow}
  994. #endif
  995.  
  996. #ifdef EPS60
  997.     ,{"epson_60dpi", "Epson-style 60-dot per inch printers",
  998.        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  999.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  1000.        EPS60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  1001.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  1002.        null_justify_text, do_point, do_arrow}
  1003. #endif
  1004.  
  1005. #ifdef EPSONP
  1006.     ,{"epson_lx800", "Epson LX-800, Star NL-10, NX-1000, PROPRINTER ...",
  1007.        EPSONXMAX, EPSONYMAX, EPSONVCHAR, EPSONHCHAR, 
  1008.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset, 
  1009.        EPSONtext, null_scale, EPSONgraphics, EPSONmove, EPSONvector, 
  1010.        EPSONlinetype, EPSONput_text, EPSON_text_angle, 
  1011.        null_justify_text, line_and_point, do_arrow}
  1012. #endif
  1013.  
  1014. #ifdef EXCL
  1015.     ,{"excl", "Talaris EXCL Laser printer (also Talaris 1590 and others)",
  1016.        EXCL_XMAX,EXCL_YMAX, EXCL_VCHAR, EXCL_HCHAR, 
  1017.        EXCL_VTIC, EXCL_HTIC, options_null, EXCL_init,EXCL_reset, 
  1018.        EXCL_text, null_scale, EXCL_graphics, EXCL_move, EXCL_vector,
  1019.        EXCL_linetype,EXCL_put_text, null_text_angle, 
  1020.        null_justify_text, line_and_point, do_arrow}
  1021. #endif
  1022.  
  1023.  
  1024. #ifdef FIG
  1025.     ,{"fig", "FIG 2.1 graphics language: SunView or X graphics editor",
  1026.        FIG_XMAX, FIG_YMAX, FIG_VCHAR, FIG_HCHAR, 
  1027.        FIG_VTIC, FIG_HTIC, FIG_options, FIG_init, FIG_reset, 
  1028.        FIG_text, null_scale, FIG_graphics, FIG_move, FIG_vector, 
  1029.        FIG_linetype, FIG_put_text, FIG_text_angle, 
  1030.        FIG_justify_text, do_point, FIG_arrow}
  1031.     ,{"bfig", "FIG 2.1 graphics lang: SunView or X graphics editor. Large Graph",
  1032.        BFIG_XMAX, BFIG_YMAX, BFIG_VCHAR, BFIG_HCHAR, 
  1033.        BFIG_VTIC, BFIG_HTIC, FIG_options, FIG_init, FIG_reset, 
  1034.        FIG_text, null_scale, FIG_graphics, FIG_move, BFIG_vector, 
  1035.        FIG_linetype, BFIG_put_text, FIG_text_angle, 
  1036.        FIG_justify_text, do_point, BFIG_arrow}
  1037. #endif
  1038.  
  1039. #ifdef GPIC
  1040.     ,{"gpic", "GPIC -- Produce graphs in groff using the gpic preprocessor",
  1041.        GPIC_XMAX, GPIC_YMAX, GPIC_VCHAR, GPIC_HCHAR, 
  1042.        GPIC_VTIC, GPIC_HTIC, GPIC_options, GPIC_init, GPIC_reset, 
  1043.        GPIC_text, GPIC_scale, GPIC_graphics, GPIC_move, GPIC_vector, 
  1044.        GPIC_linetype, GPIC_put_text, GPIC_text_angle, 
  1045.        GPIC_justify_text, line_and_point, GPIC_arrow}
  1046. #endif
  1047.  
  1048. #ifdef GRASS
  1049.     ,{"grass", "GRASS Graphics Monitor",
  1050.            GRASS_XMAX, GRASS_YMAX, GRASS_VCHAR, GRASS_HCHAR,
  1051.            GRASS_VTIC, GRASS_HTIC, GRASS_options, GRASS_init, GRASS_reset,
  1052.            GRASS_text, null_scale, GRASS_graphics, GRASS_move, GRASS_vector,
  1053.            GRASS_linetype, GRASS_put_text, GRASS_text_angle,
  1054.            GRASS_justify_text, GRASS_point, GRASS_arrow}
  1055. #endif
  1056.  
  1057. #ifdef HP26
  1058.     ,{"hp2623A", "HP2623A and maybe others",
  1059.        HP26_XMAX, HP26_YMAX, HP26_VCHAR, HP26_HCHAR,
  1060.        HP26_VTIC, HP26_HTIC, options_null, HP26_init, HP26_reset,
  1061.        HP26_text, null_scale, HP26_graphics, HP26_move, HP26_vector,
  1062.        HP26_linetype, HP26_put_text, HP26_text_angle, 
  1063.        null_justify_text, HP26_line_and_point, do_arrow}
  1064. #endif
  1065.  
  1066. #ifdef HP2648
  1067.     ,{"hp2648", "HP2648 and HP2647",
  1068.        HP2648XMAX, HP2648YMAX, HP2648VCHAR, HP2648HCHAR, 
  1069.        HP2648VTIC, HP2648HTIC, options_null, HP2648init, HP2648reset, 
  1070.        HP2648text, null_scale, HP2648graphics, HP2648move, HP2648vector, 
  1071.        HP2648linetype, HP2648put_text, HP2648_text_angle, 
  1072.        null_justify_text, line_and_point, do_arrow}
  1073. #endif
  1074.  
  1075. #ifdef HP75
  1076.     ,{"hp7580B", "HP7580, and probably other HPs (4 pens)",
  1077.        HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  1078.        HPGL_VTIC, HPGL_HTIC, options_null, HPGL_init, HPGL_reset,
  1079.        HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  1080.        HP75_linetype, HPGL_put_text, HPGL_text_angle, 
  1081.        null_justify_text, do_point, do_arrow}
  1082. #endif
  1083.  
  1084. #ifdef HP500C
  1085.       ,{"hp500c", "HP DeskJet 500c, [75 100 150 300] [rle tiff]",
  1086.        HP500C_75PPI_XMAX, HP500C_75PPI_YMAX, HP500C_75PPI_VCHAR,
  1087.        HP500C_75PPI_HCHAR, HP500C_75PPI_VTIC, HP500C_75PPI_HTIC, HP500Coptions,
  1088.        HP500Cinit, HP500Creset, HP500Ctext, null_scale,
  1089.        HP500Cgraphics, HP500Cmove, HP500Cvector, HP500Clinetype,
  1090.        HP500Cput_text, HP500Ctext_angle, null_justify_text, do_point,
  1091.        do_arrow}
  1092. #endif
  1093.  
  1094. #ifdef HPGL
  1095.     ,{"hpgl", "HP7475 and (hopefully) lots of others (6 pens)",
  1096.        HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  1097.        HPGL_VTIC, HPGL_HTIC, options_null, HPGL_init, HPGL_reset,
  1098.        HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  1099.        HPGL_linetype, HPGL_put_text, HPGL_text_angle, 
  1100.        null_justify_text, do_point, do_arrow}
  1101. #endif
  1102.  
  1103. #ifdef HPLJII
  1104.     ,{"hpljii", "HP Laserjet series II, [75 100 150 300]",
  1105.        HPLJII_75PPI_XMAX, HPLJII_75PPI_YMAX, HPLJII_75PPI_VCHAR,
  1106.        HPLJII_75PPI_HCHAR, HPLJII_75PPI_VTIC, HPLJII_75PPI_HTIC, HPLJIIoptions,
  1107.        HPLJIIinit, HPLJIIreset, HPLJIItext, null_scale,
  1108.        HPLJIIgraphics, HPLJIImove, HPLJIIvector, HPLJIIlinetype,
  1109.        HPLJIIput_text, HPLJIItext_angle, null_justify_text, line_and_point,
  1110.        do_arrow}
  1111.     ,{"hpdj", "HP DeskJet 500, [75 100 150 300]",
  1112.        HPLJII_75PPI_XMAX, HPLJII_75PPI_YMAX, HPLJII_75PPI_VCHAR,
  1113.        HPLJII_75PPI_HCHAR, HPLJII_75PPI_VTIC, HPLJII_75PPI_HTIC, HPLJIIoptions,
  1114.        HPLJIIinit, HPLJIIreset, HPDJtext, null_scale,
  1115.        HPDJgraphics, HPLJIImove, HPLJIIvector, HPLJIIlinetype,
  1116.        HPDJput_text, HPDJtext_angle, null_justify_text, line_and_point,
  1117.        do_arrow}
  1118. #endif
  1119.  
  1120. #ifdef HPPJ
  1121.     ,{"hppj", "HP PaintJet and HP3630 [FNT5X9 FNT9X17 FNT13X25]",
  1122.        HPPJ_XMAX, HPPJ_YMAX,
  1123.        HPPJ_9x17_VCHAR, HPPJ_9x17_HCHAR, HPPJ_9x17_VTIC, HPPJ_9x17_HTIC,
  1124.        HPPJoptions, HPPJinit, HPPJreset, HPPJtext, null_scale, HPPJgraphics,
  1125.        HPPJmove, HPPJvector, HPPJlinetype, HPPJput_text, HPPJtext_angle,
  1126.        null_justify_text, do_point, do_arrow}
  1127. #endif
  1128.  
  1129. #ifdef IMAGEN
  1130.     ,{"imagen", "Imagen laser printer",
  1131.        IMAGEN_XMAX, IMAGEN_YMAX, IMAGEN_VCHAR, IMAGEN_HCHAR, 
  1132.        IMAGEN_VTIC, IMAGEN_HTIC, options_null, IMAGEN_init, IMAGEN_reset, 
  1133.        IMAGEN_text, null_scale, IMAGEN_graphics, IMAGEN_move, 
  1134.        IMAGEN_vector, IMAGEN_linetype, IMAGEN_put_text, IMAGEN_text_angle,
  1135.        IMAGEN_justify_text, line_and_point, do_arrow}
  1136. #endif
  1137.  
  1138. #ifdef IRIS4D
  1139.     ,{"iris4d", "Silicon Graphics IRIS 4D Series Computer",
  1140.        IRIS4D_XMAX, IRIS4D_YMAX, IRIS4D_VCHAR, IRIS4D_HCHAR, 
  1141.        IRIS4D_VTIC, IRIS4D_HTIC, IRIS4D_options, IRIS4D_init, IRIS4D_reset, 
  1142.        IRIS4D_text, null_scale, IRIS4D_graphics, IRIS4D_move, IRIS4D_vector,
  1143.        IRIS4D_linetype, IRIS4D_put_text, null_text_angle, 
  1144.        null_justify_text, do_point, do_arrow}
  1145. #endif
  1146.  
  1147. #ifdef KERMIT
  1148.     ,{"kc_tek40xx", "MS-DOS Kermit Tek4010 terminal emulator - color",
  1149.        TEK40XMAX,TEK40YMAX,TEK40VCHAR, KTEK40HCHAR, 
  1150.        TEK40VTIC, TEK40HTIC, options_null, TEK40init, KTEK40reset, 
  1151.        KTEK40Ctext, null_scale, KTEK40graphics, TEK40move, TEK40vector, 
  1152.        KTEK40Clinetype, TEK40put_text, null_text_angle, 
  1153.        null_justify_text, do_point, do_arrow}
  1154.     ,{"km_tek40xx", "MS-DOS Kermit Tek4010 terminal emulator - monochrome",
  1155.        TEK40XMAX,TEK40YMAX,TEK40VCHAR, KTEK40HCHAR, 
  1156.        TEK40VTIC, TEK40HTIC, options_null, TEK40init, KTEK40reset, 
  1157.        TEK40text, null_scale, KTEK40graphics, TEK40move, TEK40vector, 
  1158.        KTEK40Mlinetype, TEK40put_text, null_text_angle, 
  1159.        null_justify_text, line_and_point, do_arrow}
  1160. #endif
  1161.  
  1162. #ifdef LATEX
  1163.     ,{"latex", "LaTeX picture environment",
  1164.        LATEX_XMAX, LATEX_YMAX, LATEX_VCHAR, LATEX_HCHAR, 
  1165.        LATEX_VTIC, LATEX_HTIC, LATEX_options, LATEX_init, LATEX_reset, 
  1166.        LATEX_text, LATEX_scale, LATEX_graphics, LATEX_move, LATEX_vector, 
  1167.        LATEX_linetype, LATEX_put_text, LATEX_text_angle, 
  1168.        LATEX_justify_text, LATEX_point, LATEX_arrow}
  1169. #endif
  1170.  
  1171. #ifdef LN03P
  1172.      ,{"ln03", "LN03-plus laser printer in tektronix (EGM) mode",
  1173.     LN03PXMAX, LN03PYMAX, LN03PVCHAR, LN03PHCHAR,
  1174.     LN03PVTIC, LN03PHTIC, options_null, LN03Pinit, LN03Preset,
  1175.     LN03Ptext, null_scale, TEK40graphics, LN03Pmove, LN03Pvector,
  1176.     LN03Plinetype, LN03Pput_text, null_text_angle,
  1177.     null_justify_text, line_and_point, do_arrow}
  1178. #endif
  1179.  
  1180. #ifdef MF
  1181.     ,{"mf", "Metafont plotting standard",
  1182.        MF_XMAX, MF_YMAX, MF_VCHAR, MF_HCHAR, 
  1183.        MF_VTIC, MF_HTIC, options_null, MF_init, MF_reset, 
  1184.        MF_text, MF_scale, MF_graphics, MF_move, MF_vector, 
  1185.        MF_linetype, MF_put_text, MF_text_angle, 
  1186.        MF_justify_text, line_and_point, MF_arrow}
  1187. #endif
  1188.  
  1189. #ifdef MIF
  1190.     ,{"mif", "Frame maker MIF 3.00 format",
  1191.        MIF_XMAX, MIF_YMAX, MIF_VCHAR, MIF_HCHAR, 
  1192.        MIF_VTIC, MIF_HTIC, MIF_options, MIF_init, MIF_reset, 
  1193.        MIF_text, null_scale, MIF_graphics, MIF_move, MIF_vector, 
  1194.        MIF_linetype, MIF_put_text, null_text_angle, 
  1195.        MIF_justify_text, line_and_point, do_arrow}
  1196. #endif
  1197.  
  1198. #ifdef NEC
  1199.     ,{"nec_cp6", "NEC printer CP6, Epson LQ-800 [monocrome color draft]",
  1200.        NECXMAX, NECYMAX, NECVCHAR, NECHCHAR, 
  1201.        NECVTIC, NECHTIC, NECoptions, NECinit, NECreset, 
  1202.        NECtext, null_scale, NECgraphics, NECmove, NECvector, 
  1203.        NEClinetype, NECput_text, NEC_text_angle, 
  1204.        null_justify_text, line_and_point, do_arrow}
  1205. #endif
  1206.  
  1207. #ifdef NEXT
  1208.     ,{"next", "NeXTstep window system",
  1209.        NEXT_XMAX, NEXT_YMAX, NEXT_VCHAR, NEXT_HCHAR, 
  1210.        NEXT_VTIC, NEXT_HTIC, NEXT_options, NEXT_init, NEXT_reset, 
  1211.        NEXT_text, do_scale, NEXT_graphics, NEXT_move, NEXT_vector, 
  1212.        NEXT_linetype, NEXT_put_text, NEXT_text_angle, 
  1213.        NEXT_justify_text, NEXT_point, do_arrow}
  1214. #endif /* The PostScript driver with NXImage displaying the PostScript on screen */
  1215.  
  1216. #ifdef OS2PM
  1217.     ,{"pm", "OS/2 Presentation Manager",
  1218.        PM_XMAX, PM_YMAX, PM_VCHAR, PM_HCHAR, 
  1219.        PM_VTIC, PM_HTIC, PM_args, PM_init, PM_reset, 
  1220.        PM_text, null_scale, PM_graphics, PM_move, PM_vector,
  1221.        PM_linetype, PM_put_text, PM_text_angle, 
  1222.        PM_justify_text, PM_point, do_arrow}
  1223. #endif
  1224.  
  1225. #ifdef PBM
  1226.     ,{"pbm", "Portable bitmap [small medium large] [monochrome gray color]",
  1227.        PBM_XMAX, PBM_YMAX, PBM_VCHAR,
  1228.        PBM_HCHAR, PBM_VTIC, PBM_HTIC, PBMoptions,
  1229.        PBMinit, PBMreset, PBMtext, null_scale,
  1230.        PBMgraphics, PBMmove, PBMvector, PBMlinetype,
  1231.        PBMput_text, PBMtext_angle, null_justify_text, PBMpoint,
  1232.        do_arrow}
  1233. #endif
  1234.  
  1235. #ifdef PCL
  1236.  ,{"pcl5", "HP LaserJet III [mode] [font] [point]",
  1237.    PCL_XMAX, PCL_YMAX, HPGL2_VCHAR, HPGL2_HCHAR,
  1238.    PCL_VTIC, PCL_HTIC, PCL_options, PCL_init, PCL_reset,
  1239.    PCL_text, null_scale, PCL_graphics, HPGL2_move, HPGL2_vector,
  1240.    HPGL2_linetype, HPGL2_put_text, HPGL2_text_angle,
  1241.    HPGL2_justify_text, do_point, do_arrow}
  1242. #endif
  1243.  
  1244. #ifdef POSTSCRIPT
  1245.     ,{"postscript", "PostScript graphics language [mode \042fontname\042 font_size]",
  1246.        PS_XMAX, PS_YMAX, PS_VCHAR, PS_HCHAR, 
  1247.        PS_VTIC, PS_HTIC, PS_options, PS_init, PS_reset, 
  1248.        PS_text, null_scale, PS_graphics, PS_move, PS_vector, 
  1249.        PS_linetype, PS_put_text, PS_text_angle, 
  1250.        PS_justify_text, PS_point, do_arrow}
  1251. #endif
  1252.  
  1253. #ifdef PRESCRIBE
  1254.     ,{"prescribe", "Prescribe - for the Kyocera Laser Printer",
  1255.     PRE_XMAX, PRE_YMAX, PRE_VCHAR, PRE_HCHAR, 
  1256.     PRE_VTIC, PRE_HTIC, options_null, PRE_init, PRE_reset, 
  1257.     PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector, 
  1258.     PRE_linetype, PRE_put_text, null_text_angle, 
  1259.     PRE_justify_text, line_and_point, do_arrow}
  1260.     ,{"kyo", "Kyocera Laser Printer with Courier font",
  1261.     PRE_XMAX, PRE_YMAX, KYO_VCHAR, KYO_HCHAR, 
  1262.     PRE_VTIC, PRE_HTIC, options_null, KYO_init, PRE_reset, 
  1263.     PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector, 
  1264.     PRE_linetype, PRE_put_text, null_text_angle, 
  1265.     PRE_justify_text, line_and_point, do_arrow}
  1266. #endif /* PRESCRIBE */
  1267.  
  1268. #ifdef PSLATEX
  1269.     ,{"pslatex", "LaTeX picture environment with PostScript \\specials",
  1270.     PS_XMAX, PS_YMAX, PSLATEX_VCHAR, PSLATEX_HCHAR,
  1271.     PS_VTIC, PS_HTIC, PSLATEX_options, PSLATEX_init, PSLATEX_reset,
  1272.     PSLATEX_text, PSLATEX_scale, PSLATEX_graphics, PS_move, PS_vector,
  1273.     PS_linetype, PSLATEX_put_text, PSLATEX_text_angle,
  1274.     PSLATEX_justify_text, PS_point, do_arrow}
  1275. #endif
  1276.  
  1277. #ifdef    PSTRICKS
  1278.     ,{"pstricks", "LaTeX picture environment with PSTricks macros",
  1279.        PSTRICKS_XMAX, PSTRICKS_YMAX, PSTRICKS_VCHAR, PSTRICKS_HCHAR, 
  1280.        PSTRICKS_VTIC, PSTRICKS_HTIC, options_null, PSTRICKS_init, PSTRICKS_reset, 
  1281.        PSTRICKS_text, PSTRICKS_scale, PSTRICKS_graphics, PSTRICKS_move, PSTRICKS_vector, 
  1282.        PSTRICKS_linetype, PSTRICKS_put_text, PSTRICKS_text_angle, 
  1283.        PSTRICKS_justify_text, PSTRICKS_point, PSTRICKS_arrow}
  1284. #endif
  1285.     
  1286. #ifdef QMS
  1287.     ,{"qms", "QMS/QUIC Laser printer (also Talaris 1200 and others)",
  1288.        QMS_XMAX,QMS_YMAX, QMS_VCHAR, QMS_HCHAR, 
  1289.        QMS_VTIC, QMS_HTIC, options_null, QMS_init,QMS_reset, 
  1290.        QMS_text, null_scale, QMS_graphics, QMS_move, QMS_vector,
  1291.        QMS_linetype,QMS_put_text, null_text_angle, 
  1292.        null_justify_text, line_and_point, do_arrow}
  1293. #endif
  1294.  
  1295. #ifdef REGIS
  1296.     ,{"regis", "REGIS graphics language",
  1297.        REGISXMAX, REGISYMAX, REGISVCHAR, REGISHCHAR, 
  1298.        REGISVTIC, REGISHTIC, REGISoptions, REGISinit, REGISreset, 
  1299.        REGIStext, null_scale, REGISgraphics, REGISmove, REGISvector,
  1300.        REGISlinetype, REGISput_text, REGIStext_angle, 
  1301.        null_justify_text, line_and_point, do_arrow}
  1302. #endif
  1303.  
  1304. #ifdef RGIP
  1305.     ,{"rgip", "RGIP metafile (Uniplex). Option: fontsize (1-8)",
  1306.        RGIP_XMAX, RGIP_YMAX, RGIP_VCHAR, RGIP_HCHAR,
  1307.        RGIP_VTIC, RGIP_HTIC, RGIP_options, RGIP_init, RGIP_reset,
  1308.        RGIP_text, null_scale, RGIP_graphics, RGIP_move,
  1309.        RGIP_vector, RGIP_linetype, RGIP_put_text, RGIP_text_angle,
  1310.        RGIP_justify_text, RGIP_do_point, do_arrow}
  1311.     ,{"uniplex", "RGIP metafile (Uniplex). Option: fontsize (1-8)",
  1312.        RGIP_XMAX, RGIP_YMAX, RGIP_VCHAR, RGIP_HCHAR,
  1313.        RGIP_VTIC, RGIP_HTIC, RGIP_options, RGIP_init, RGIP_reset,
  1314.        RGIP_text, null_scale, RGIP_graphics, RGIP_move,
  1315.        RGIP_vector, RGIP_linetype, RGIP_put_text, RGIP_text_angle,
  1316.        RGIP_justify_text, RGIP_do_point, do_arrow}
  1317. #endif
  1318.  
  1319. #ifdef SELANAR
  1320.     ,{"selanar", "Selanar",
  1321.        TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR, 
  1322.        TEK40VTIC, TEK40HTIC, options_null, SEL_init, SEL_reset, 
  1323.        SEL_text, null_scale, SEL_graphics, TEK40move, TEK40vector, 
  1324.        TEK40linetype, TEK40put_text, null_text_angle, 
  1325.        null_justify_text, line_and_point, do_arrow}
  1326. #endif
  1327.  
  1328. #ifdef STARC
  1329.     ,{"starc", "Star Color Printer",
  1330.        STARCXMAX, STARCYMAX, STARCVCHAR, STARCHCHAR, 
  1331.        STARCVTIC, STARCHTIC, options_null, STARCinit, STARCreset, 
  1332.        STARCtext, null_scale, STARCgraphics, STARCmove, STARCvector, 
  1333.        STARClinetype, STARCput_text, STARC_text_angle, 
  1334.        null_justify_text, line_and_point, do_arrow}
  1335. #endif
  1336.  
  1337. #ifdef SUN
  1338.     ,{"sun", "SunView window system",
  1339.        SUN_XMAX, SUN_YMAX, SUN_VCHAR, SUN_HCHAR, 
  1340.        SUN_VTIC, SUN_HTIC, options_null, SUN_init, SUN_reset, 
  1341.        SUN_text, null_scale, SUN_graphics, SUN_move, SUN_vector,
  1342.        SUN_linetype, SUN_put_text, null_text_angle, 
  1343.        SUN_justify_text, line_and_point, do_arrow}
  1344. #endif
  1345.  
  1346. #ifdef VWS
  1347.     ,{"VWS", "VAX Windowing System (UIS)",
  1348.            VWS_XMAX, VWS_YMAX, VWS_VCHAR, VWS_HCHAR,
  1349.            VWS_VTIC, VWS_HTIC, options_null, VWS_init, VWS_reset,
  1350.            VWS_text, null_scale, VWS_graphics, VWS_move, VWS_vector,
  1351.            VWS_linetype, VWS_put_text, VWS_text_angle,
  1352.            VWS_justify_text, do_point, do_arrow}
  1353. #endif
  1354.  
  1355. #ifdef TANDY60
  1356.     ,{"tandy_60dpi", "Tandy DMP-130 series 60-dot per inch graphics",
  1357.        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  1358.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  1359.        TANDY60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  1360.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  1361.        null_justify_text, do_point, do_arrow}
  1362. #endif
  1363.  
  1364. #ifdef T410X
  1365.     ,{"tek410x", "Tektronix 4106, 4107, 4109 and 420X terminals",
  1366.        T410XXMAX, T410XYMAX, T410XVCHAR, T410XHCHAR, 
  1367.        T410XVTIC, T410XHTIC, options_null, T410X_init, T410X_reset, 
  1368.        T410X_text, null_scale, T410X_graphics, T410X_move, T410X_vector, 
  1369.        T410X_linetype, T410X_put_text, T410X_text_angle, 
  1370.        null_justify_text, T410X_point, do_arrow}
  1371. #endif
  1372.  
  1373. #ifdef TEK
  1374.     ,{"tek40xx", "Tektronix 4010 and others; most TEK emulators",
  1375.        TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR, 
  1376.        TEK40VTIC, TEK40HTIC, options_null, TEK40init, TEK40reset, 
  1377.        TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector, 
  1378.        TEK40linetype, TEK40put_text, null_text_angle, 
  1379.        null_justify_text, line_and_point, do_arrow}
  1380. #endif
  1381.  
  1382. #ifdef TEXDRAW
  1383.     ,{"texdraw", "LaTeX texdraw environment",
  1384.        TEXDRAW_XMAX, TEXDRAW_YMAX, TEXDRAW_VCHAR, TEXDRAW_HCHAR,
  1385.     TEXDRAW_VTIC, TEXDRAW_HTIC, options_null, TEXDRAW_init, TEXDRAW_reset,
  1386.     TEXDRAW_text, TEXDRAW_scale, TEXDRAW_graphics, TEXDRAW_move, TEXDRAW_vector,
  1387.     TEXDRAW_linetype, TEXDRAW_put_text, TEXDRAW_text_angle,
  1388.     TEXDRAW_justify_text, TEXDRAW_point, TEXDRAW_arrow}
  1389. #endif
  1390.   
  1391. #ifdef TGIF
  1392.     ,{"tgif", "TGIF X-Window draw tool (file version 10)",
  1393.        TGIF_XMAX, TGIF_YMAX, TGIF_VCHAR1, TGIF_HCHAR1, 
  1394.        TGIF_VTIC, TGIF_HTIC, options_null, TGIF_init, TGIF_reset, 
  1395.        TGIF_text, null_scale, TGIF_graphics, TGIF_move, TGIF_vector, 
  1396.        TGIF_linetype, TGIF_put_text, TGIF_text_angle, 
  1397.        TGIF_justify_text, line_and_point, TGIF_arrow}
  1398. #endif
  1399.  
  1400. #ifdef TPIC
  1401.     ,{"tpic", "TPIC -- LaTeX picture environment with tpic \\specials",
  1402.        TPIC_XMAX, TPIC_YMAX, TPIC_VCHAR, TPIC_HCHAR, 
  1403.        TPIC_VTIC, TPIC_HTIC, TPIC_options, TPIC_init, TPIC_reset, 
  1404.        TPIC_text, TPIC_scale, TPIC_graphics, TPIC_move, TPIC_vector, 
  1405.        TPIC_linetype, TPIC_put_text, TPIC_text_angle, 
  1406.        TPIC_justify_text, TPIC_point, TPIC_arrow}
  1407. #endif
  1408.  
  1409. #ifdef UNIXPLOT
  1410. #ifdef GNUGRAPH
  1411.     ,{"unixplot", "GNU plot(1) format [\042fontname\042 font_size]",
  1412.        UP_XMAX, UP_YMAX, UP_VCHAR, UP_HCHAR,
  1413.        UP_VTIC, UP_HTIC, UP_options, UP_init, UP_reset,
  1414.        UP_text, null_scale, UP_graphics, UP_move, UP_vector,
  1415.        UP_linetype, UP_put_text, UP_text_angle,
  1416.        UP_justify_text, line_and_point, do_arrow}
  1417. #else
  1418.     ,{"unixplot", "Unix plotting standard (see plot(1))",
  1419.        UP_XMAX, UP_YMAX, UP_VCHAR, UP_HCHAR, 
  1420.        UP_VTIC, UP_HTIC, options_null, UP_init, UP_reset, 
  1421.        UP_text, null_scale, UP_graphics, UP_move, UP_vector, 
  1422.        UP_linetype, UP_put_text, null_text_angle, 
  1423.        null_justify_text, line_and_point, do_arrow}
  1424. #endif /* GNUGRAPH */
  1425. #endif
  1426.     
  1427. #ifdef UNIXPC
  1428.     ,{"unixpc", "AT&T 3b1 or AT&T 7300 Unix PC",
  1429.        uPC_XMAX, uPC_YMAX, uPC_VCHAR, uPC_HCHAR, 
  1430.        uPC_VTIC, uPC_HTIC, options_null, uPC_init, uPC_reset, 
  1431.        uPC_text, null_scale, uPC_graphics, uPC_move, uPC_vector,
  1432.        uPC_linetype, uPC_put_text, uPC_text_angle, 
  1433.        null_justify_text, line_and_point, do_arrow}
  1434. #endif
  1435.  
  1436. #ifdef EMXVGA
  1437. #ifdef EMXVESA
  1438.     ,{"vesa", "IBM PC/Clone with VESA SVGA graphics board [vesa mode]",
  1439.        EMXVGA_XMAX, EMXVGA_YMAX, EMXVGA_VCHAR, EMXVGA_HCHAR,
  1440.        EMXVGA_VTIC, EMXVGA_HTIC, EMXVESA_options, EMXVESA_init, EMXVESA_reset,
  1441.        EMXVESA_text, null_scale, EMXVESA_graphics, EMXVGA_move, EMXVGA_vector,
  1442.        EMXVGA_linetype, EMXVGA_put_text, EMXVGA_text_angle, 
  1443.        null_justify_text, do_point, do_arrow}
  1444. #endif
  1445.     ,{"vgal", "IBM PC/Clone with VGA graphics board",
  1446.        EMXVGA_XMAX, EMXVGA_YMAX, EMXVGA_VCHAR, EMXVGA_HCHAR,
  1447.        EMXVGA_VTIC, EMXVGA_HTIC, options_null, EMXVGA_init, EMXVGA_reset,
  1448.        EMXVGA_text, null_scale, EMXVGA_graphics, EMXVGA_move, EMXVGA_vector,
  1449.        EMXVGA_linetype, EMXVGA_put_text, EMXVGA_text_angle, 
  1450.        null_justify_text, do_point, do_arrow}
  1451. #endif
  1452.  
  1453. #ifdef V384
  1454.     ,{"vx384", "Vectrix 384 and Tandy color printer",
  1455.        V384_XMAX, V384_YMAX, V384_VCHAR, V384_HCHAR, 
  1456.        V384_VTIC, V384_HTIC, options_null, V384_init, V384_reset, 
  1457.        V384_text, null_scale, V384_graphics, V384_move, V384_vector, 
  1458.        V384_linetype, V384_put_text, null_text_angle, 
  1459.        null_justify_text, do_point, do_arrow}
  1460. #endif
  1461.  
  1462. #ifdef VTTEK
  1463.     ,{"vttek", "VT-like tek40xx terminal emulator",
  1464.        TEK40XMAX,TEK40YMAX,TEK40VCHAR, TEK40HCHAR,
  1465.        TEK40VTIC, TEK40HTIC, options_null, VTTEK40init, VTTEK40reset,
  1466.        TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector,
  1467.        VTTEK40linetype, VTTEK40put_text, null_text_angle,
  1468.        null_justify_text, line_and_point, do_arrow}
  1469. #endif
  1470.  
  1471. #ifdef _Windows
  1472.     ,{"windows", "Microsoft Windows",
  1473.        WIN_XMAX, WIN_YMAX, WIN_VCHAR, WIN_HCHAR, 
  1474.        WIN_VTIC, WIN_HTIC, WIN_options, WIN_init, WIN_reset, 
  1475.        WIN_text, WIN_scale, WIN_graphics, WIN_move, WIN_vector,
  1476.        WIN_linetype, WIN_put_text, WIN_text_angle, 
  1477.        WIN_justify_text, WIN_point, do_arrow}
  1478. #endif
  1479.  
  1480. #ifdef X11
  1481.     ,{"x11", "X11 Window System",
  1482.        X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR, 
  1483.        X11_VTIC, X11_HTIC, options_null, X11_init, X11_reset, 
  1484.        X11_text, null_scale, X11_graphics, X11_move, X11_vector, 
  1485.        X11_linetype, X11_put_text, null_text_angle, 
  1486.        X11_justify_text, X11_point, do_arrow}
  1487.     ,{"X11", "X11 Window System (identical to x11)",
  1488.        X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR, 
  1489.        X11_VTIC, X11_HTIC, options_null, X11_init, X11_reset, 
  1490.        X11_text, null_scale, X11_graphics, X11_move, X11_vector, 
  1491.        X11_linetype, X11_put_text, null_text_angle, 
  1492.        X11_justify_text, X11_point, do_arrow}
  1493.    ,{"xlib", "X11 Window System (gnulib_x11 dump)",
  1494.        Xlib_XMAX, Xlib_YMAX, Xlib_VCHAR, Xlib_HCHAR, 
  1495.        Xlib_VTIC, Xlib_HTIC, options_null, Xlib_init, Xlib_reset, 
  1496.        Xlib_text, null_scale, Xlib_graphics, Xlib_move, Xlib_vector, 
  1497.        Xlib_linetype, Xlib_put_text, null_text_angle, 
  1498.        Xlib_justify_text, line_and_point, do_arrow}
  1499. #endif
  1500. };
  1501.  
  1502. #define TERMCOUNT (sizeof(term_tbl)/sizeof(struct termentry))
  1503.  
  1504.  
  1505. list_terms()
  1506. {
  1507. register int i;
  1508.  
  1509.     fprintf(stderr,"\nAvailable terminal types:\n");
  1510.     for (i = 0; i < TERMCOUNT; i++)
  1511.         fprintf(stderr,"  %15s  %s\n",
  1512.                term_tbl[i].name, term_tbl[i].description);
  1513.     (void) putc('\n',stderr);
  1514. }
  1515.  
  1516.  
  1517. /* set_term: get terminal number from name on command line */
  1518. /* will change 'term' variable if successful */
  1519. int                        /* term number */
  1520. set_term(c_token)
  1521. int c_token;
  1522. {
  1523.     register int t;
  1524.     char *input_name;
  1525.  
  1526.     if (!token[c_token].is_token)
  1527.      int_error("terminal name expected",c_token);
  1528.     t = -1;
  1529.     input_name = input_line + token[c_token].start_index;
  1530.     t = change_term(input_name, token[c_token].length);
  1531.     if (t == -1)
  1532.      int_error("unknown terminal type; type just 'set terminal' for a list",
  1533.              c_token);
  1534.     if (t == -2)
  1535.      int_error("ambiguous terminal name; type just 'set terminal' for a list",
  1536.              c_token);
  1537.  
  1538.     /* otherwise the type was changed */
  1539.  
  1540.     return(t);
  1541. }
  1542.  
  1543. /* change_term: get terminal number from name and set terminal type */
  1544. /* returns -1 if unknown, -2 if ambiguous, >=0 is terminal number */
  1545. int
  1546. change_term(name, length)
  1547.     char *name;
  1548.     int length;
  1549. {
  1550.     int i, t = -1;
  1551.  
  1552.     for (i = 0; i < TERMCOUNT; i++) {
  1553.        if (!strncmp(name,term_tbl[i].name,length)) {
  1554.           if (t != -1)
  1555.             return(-2);    /* ambiguous */
  1556.           t = i;
  1557.        }
  1558.     }
  1559.  
  1560.     if (t == -1)            /* unknown */
  1561.      return(t);
  1562.  
  1563.     /* Success: set terminal type now */
  1564.  
  1565.     term = t;
  1566.     term_init = FALSE;
  1567.     name = term_tbl[term].name;
  1568.  
  1569.     /* Special handling for unixplot term type */
  1570.     if (!strncmp("unixplot",name,8)) {
  1571.        UP_redirect (2);  /* Redirect actual stdout for unixplots */
  1572.     } else if (unixplot) {
  1573.        UP_redirect (3);  /* Put stdout back together again. */
  1574.     }
  1575.  
  1576.     if (interactive)
  1577.      fprintf(stderr, "Terminal type set to '%s'\n", name);
  1578.  
  1579.     return(t);
  1580. }
  1581.  
  1582. /*
  1583.    Routine to detect what terminal is being used (or do anything else
  1584.    that would be nice).  One anticipated (or allowed for) side effect
  1585.    is that the global ``term'' may be set. 
  1586.    The environment variable GNUTERM is checked first; if that does
  1587.    not exist, then the terminal hardware is checked, if possible, 
  1588.    and finally, we can check $TERM for some kinds of terminals.
  1589.    A default can be set with -DDEFAULTTERM=myterm in the Makefile
  1590.    or #define DEFAULTTERM myterm in term.h
  1591. */
  1592. /* thanks to osupyr!alden (Dave Alden) for the original GNUTERM code */
  1593. init_terminal()
  1594. {
  1595.     int t;
  1596. #ifdef DEFAULTTERM
  1597.     char *term_name = DEFAULTTERM;
  1598. #else
  1599.     char *term_name = NULL;
  1600. #endif /* DEFAULTTERM */
  1601. #if (defined(__TURBOC__) && defined(MSDOS) && !defined(_Windows)) || defined(NEXT) || defined(SUN) || defined(X11)
  1602.     char *term = NULL;        /* from TERM environment var */
  1603. #endif
  1604. #ifdef X11
  1605.     char *display = NULL;
  1606. #endif
  1607.     char *gnuterm = NULL;
  1608.  
  1609.     /* GNUTERM environment variable is primary */
  1610.     gnuterm = getenv("GNUTERM");
  1611.     if (gnuterm != (char *)NULL) {
  1612.      term_name = gnuterm;
  1613. #ifndef _Windows
  1614. #if defined(__TURBOC__) && defined(MSDOS)
  1615.          get_path();   /* So *_init() can find the BGI driver */
  1616. # endif
  1617. #endif
  1618.     }
  1619.     else {
  1620. #if defined(__TURBOC__) && defined(MSDOS) && !defined(_Windows)
  1621.        term_name = turboc_init();
  1622.        term = (char *)NULL; /* shut up turbo C */
  1623. #endif
  1624.        
  1625. #ifdef __ZTC__
  1626.       term_name = ztc_init();
  1627. #endif
  1628.  
  1629. #ifdef vms
  1630.        term_name = vms_init();
  1631. #endif
  1632.  
  1633. #ifdef NEXT
  1634.     term = getenv("TERM");
  1635.     if (term_name == (char *)NULL
  1636.         && term != (char *)NULL && strcmp(term,"next") == 0)
  1637.           term_name = "next";
  1638. #endif /* NeXT */
  1639.        
  1640. #ifdef SUN
  1641.        term = getenv("TERM");    /* try $TERM */
  1642.        if (term_name == (char *)NULL
  1643.           && term != (char *)NULL && strcmp(term, "sun") == 0)
  1644.         term_name = "sun";
  1645. #endif /* sun */
  1646.  
  1647. #ifdef _Windows
  1648.         term_name = "win";
  1649. #endif /* _Windows */
  1650.  
  1651. #ifdef GPR
  1652.    if (gpr_isa_pad()) term_name = "gpr";       /* find out whether stdout is a DM pad. See term/gpr.trm */
  1653. #else
  1654. #ifdef APOLLO
  1655.    if (apollo_isa_pad()) term_name = "apollo"; /* find out whether stdout is a DM pad. See term/apollo.trm */
  1656. #endif /* APOLLO */
  1657. #endif /* GPR    */
  1658.  
  1659. #ifdef X11
  1660.        term = getenv("TERM");    /* try $TERM */
  1661.        if (term_name == (char *)NULL
  1662.           && term != (char *)NULL && strcmp(term, "xterm") == 0)
  1663.         term_name = "x11";
  1664.        display = getenv("DISPLAY");
  1665.        if (term_name == (char *)NULL && display != (char *)NULL)
  1666.         term_name = "x11";
  1667.        if (X11_Display)
  1668.         term_name = "x11";
  1669. #endif /* x11 */
  1670.  
  1671. #ifdef AMIGASCREEN
  1672.        term_name = "amiga";
  1673. #endif
  1674.  
  1675. #ifdef ATARI
  1676.        term_name = "atari";
  1677. #endif
  1678.  
  1679. #ifdef UNIXPC
  1680.            if (iswind() == 0) {
  1681.               term_name = "unixpc";
  1682.            }
  1683. #endif /* unixpc */
  1684.  
  1685. #ifdef CGI
  1686.        if (getenv("CGIDISP") || getenv("CGIPRNT"))
  1687.          term_name = "cgi";
  1688. #endif /*CGI */
  1689.  
  1690. #if defined(MSDOS) && defined(__EMX__)
  1691. #ifdef EMXVESA
  1692.        term_name = "vesa";
  1693. #else
  1694.        term_name = "vgal";
  1695. #endif
  1696. #endif
  1697.  
  1698. #ifdef DJGPP
  1699.         term_name = "svga";
  1700. #endif
  1701.  
  1702. #ifdef GRASS
  1703.         term_name = "grass";
  1704. #endif
  1705.  
  1706. #ifdef OS2
  1707.            term_name = "pm" ;
  1708.             /* EMX compiler has getcwd that can return drive */
  1709.            if( PM_path[0]=='\0' ) _getcwd2( PM_path, 256 ) ;
  1710. #endif /*OS2 */           
  1711.     }
  1712.  
  1713.     /* We have a name, try to set term type */
  1714.     if (term_name != NULL && *term_name != '\0') {
  1715.        t = change_term(term_name, (int)strlen(term_name));
  1716.        if (t == -1)
  1717.         fprintf(stderr, "Unknown terminal name '%s'\n", term_name);
  1718.        else if (t == -2)
  1719.         fprintf(stderr, "Ambiguous terminal name '%s'\n", term_name);
  1720.        else                /* successful */
  1721.         ;
  1722.     }
  1723. }
  1724.  
  1725.  
  1726. #ifndef _Windows
  1727. #if defined (__TURBOC__) && defined (MSDOS)
  1728. char *
  1729. turboc_init()
  1730. {
  1731.   int g_driver,g_mode;
  1732.   char far *c1,*c2;
  1733.   char *term_name = NULL;
  1734.   struct text_info tinfo;       /* So we can restore starting text mode. */
  1735.  
  1736. /* Some of this code including BGI drivers is copyright Borland Intl. */
  1737.     g_driver=DETECT;
  1738.           get_path();
  1739.     gettextinfo(&tinfo);
  1740.         initgraph(&g_driver,&g_mode,path);
  1741.         c1=getdrivername();
  1742.         c2=getmodename(g_mode);
  1743.           switch (g_driver){
  1744.             case -2: fprintf(stderr,"Graphics card not detected.\n");
  1745.                      break;
  1746.             case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
  1747.                      break;
  1748.             case -4: fprintf(stderr,"Invalid BGI driver file.\n");
  1749.                      break;
  1750.             case -5: fprintf(stderr,"Insufficient memory to load ",
  1751.                              "graphics driver.");
  1752.                      break;
  1753.             case 1 : term_name = "cga";
  1754.                      break;
  1755.             case 2 : term_name = "mcga";
  1756.                      break;
  1757.             case 3 : 
  1758.             case 4 : term_name = "egalib";
  1759.                      break;
  1760.             case 7 : term_name = "hercules";
  1761.                      break;
  1762.             case 8 : term_name = "att";
  1763.                      break;
  1764.             case 9 : term_name = "vgalib";
  1765.                      break;
  1766.             }
  1767.         closegraph();
  1768.         textmode(tinfo.currmode);
  1769.     clrscr();
  1770.     fprintf(stderr,"\tTC Graphics, driver %s  mode %s\n",c1,c2);
  1771.   return(term_name);
  1772. }
  1773. # endif /* __TURBOC__ */
  1774. #endif
  1775.  
  1776. #if defined(__ZTC__)
  1777. char *
  1778. ztc_init()
  1779. {
  1780.   int g_mode;
  1781.   char *term_name = NULL;
  1782.  
  1783.     g_mode = fg_init();
  1784.  
  1785.           switch (g_mode){
  1786.             case FG_NULL      :  fprintf(stderr,"Graphics card not detected or not supported.\n");
  1787.                                  exit(1);
  1788.             case FG_HERCFULL  :  term_name = "hercules";
  1789.                                  break;
  1790.             case FG_EGAMONO   :  term_name = "egamono";
  1791.                                  break;
  1792.             case FG_EGAECD      :  term_name = "egalib";
  1793.                                  break;
  1794.             case FG_VGA11      :  term_name = "vgamono";
  1795.                                  break;
  1796.             case FG_VGA12      :  term_name = "vgalib";
  1797.                                  break;
  1798.             case FG_VESA6A      :  term_name = "svgalib";
  1799.                                  break;
  1800.             case FG_VESA5      :  term_name = "ssvgalib";
  1801.                                  break;
  1802.             }
  1803.         fg_term();
  1804.   return(term_name);
  1805. }
  1806. #endif /* __ZTC__ */
  1807.  
  1808.  
  1809. /*
  1810.     This is always defined so we don't have to have command.c know if it
  1811.     is there or not.
  1812. */
  1813. #ifndef UNIXPLOT
  1814. UP_redirect(caller) int caller; 
  1815. {
  1816.     caller = caller;    /* to stop Turbo C complaining 
  1817.                          * about caller not being used */
  1818. }
  1819. #else
  1820. UP_redirect (caller)
  1821. int caller;
  1822. /*
  1823.     Unixplot can't really write to outfile--it wants to write to stdout.
  1824.     This is normally ok, but the original design of gnuplot gives us
  1825.     little choice.  Originally users of unixplot had to anticipate
  1826.     their needs and redirect all I/O to a file...  Not very gnuplot-like.
  1827.  
  1828.     caller:  1 - called from SET OUTPUT "FOO.OUT"
  1829.              2 - called from SET TERM UNIXPLOT
  1830.              3 - called from SET TERM other
  1831.              4 - called from SET OUTPUT
  1832. */
  1833. {
  1834.     switch (caller) {
  1835.     case 1:
  1836.     /* Don't save, just replace stdout w/outfile (save was already done). */
  1837.         if (unixplot)
  1838.             *(stdout) = *(outfile);  /* Copy FILE structure */
  1839.     break;
  1840.     case 2:
  1841.         if (!unixplot) {
  1842.             fflush(stdout);
  1843.             save_stdout = *(stdout);
  1844.             *(stdout) = *(outfile);  /* Copy FILE structure */
  1845.             unixplot = 1;
  1846.         }
  1847.     break;
  1848.     case 3:
  1849.     /* New terminal in use--put stdout back to original. */
  1850.         /* closepl(); */  /* This is called by the term. */
  1851.         fflush(stdout);
  1852.         *(stdout) = save_stdout;  /* Copy FILE structure */
  1853.         unixplot = 0;
  1854.     break;
  1855.     case 4:
  1856.     /*  User really wants to go to normal output... */
  1857.         if (unixplot) {
  1858.             fflush(stdout);
  1859.             *(stdout) = save_stdout;  /* Copy FILE structure */
  1860.         }
  1861.     break;
  1862.     }
  1863. }
  1864. #endif
  1865.  
  1866.  
  1867. /* test terminal by drawing border and text */
  1868. /* called from command test */
  1869. test_term()
  1870. {
  1871.     register struct termentry *t = &term_tbl[term];
  1872.     char *str;
  1873.     int x,y, xl,yl, i;
  1874.     unsigned int xmax, ymax;
  1875.     char label[MAX_ID_LEN];
  1876.     int scaling;
  1877.  
  1878.     if (!term_init) {
  1879.        (*t->init)();
  1880.        term_init = TRUE;
  1881.     }
  1882.     screen_ok = FALSE;
  1883.     scaling = (*t->scale)(xsize, ysize);
  1884.     xmax = (unsigned int)(t->xmax * (scaling ? 1 : xsize));
  1885.     ymax = (unsigned int)(t->ymax * (scaling ? 1 : ysize));
  1886.     (*t->graphics)();
  1887.     /* border linetype */
  1888.     (*t->linetype)(-2);
  1889.     (*t->move)(0,0);
  1890.     (*t->vector)(xmax-1,0);
  1891.     (*t->vector)(xmax-1,ymax-1);
  1892.     (*t->vector)(0,ymax-1);
  1893.     (*t->vector)(0,0);
  1894.     (void) (*t->justify_text)(LEFT);
  1895.     (*t->put_text)(t->h_char*5,ymax-t->v_char*3,"Terminal Test");
  1896.     /* axis linetype */
  1897.     (*t->linetype)(-1);
  1898.     (*t->move)(xmax/2,0);
  1899.     (*t->vector)(xmax/2,ymax-1);
  1900.     (*t->move)(0,ymax/2);
  1901.     (*t->vector)(xmax-1,ymax/2);
  1902.     /* test width and height of characters */
  1903.     (*t->linetype)(-2);
  1904.     (*t->move)(  xmax/2-t->h_char*10,ymax/2+t->v_char/2);
  1905.     (*t->vector)(xmax/2+t->h_char*10,ymax/2+t->v_char/2);
  1906.     (*t->vector)(xmax/2+t->h_char*10,ymax/2-t->v_char/2);
  1907.     (*t->vector)(xmax/2-t->h_char*10,ymax/2-t->v_char/2);
  1908.     (*t->vector)(xmax/2-t->h_char*10,ymax/2+t->v_char/2);
  1909.     (*t->put_text)(xmax/2-t->h_char*10,ymax/2,
  1910.         "12345678901234567890");
  1911.     /* test justification */
  1912.     (void) (*t->justify_text)(LEFT);
  1913.     (*t->put_text)(xmax/2,ymax/2+t->v_char*6,"left justified");
  1914.     str = "centre+d text";
  1915.     if ((*t->justify_text)(CENTRE))
  1916.         (*t->put_text)(xmax/2,
  1917.                 ymax/2+t->v_char*5,str);
  1918.     else
  1919.         (*t->put_text)(xmax/2-strlen(str)*t->h_char/2,
  1920.                 ymax/2+t->v_char*5,str);
  1921.     str = "right justified";
  1922.     if ((*t->justify_text)(RIGHT))
  1923.         (*t->put_text)(xmax/2,
  1924.                 ymax/2+t->v_char*4,str);
  1925.     else
  1926.         (*t->put_text)(xmax/2-strlen(str)*t->h_char,
  1927.                 ymax/2+t->v_char*4,str);
  1928.     /* test text angle */
  1929.     str = "rotated ce+ntred text";
  1930.     if ((*t->text_angle)(1)) {
  1931.         if ((*t->justify_text)(CENTRE))
  1932.             (*t->put_text)(t->v_char,
  1933.                 ymax/2,str);
  1934.         else
  1935.             (*t->put_text)(t->v_char,
  1936.                 ymax/2-strlen(str)*t->h_char/2,str);
  1937.     }
  1938.     else {
  1939.         (void) (*t->justify_text)(LEFT);
  1940.         (*t->put_text)(t->h_char*2,ymax/2-t->v_char*2,"Can't rotate text");
  1941.     }
  1942.     (void) (*t->justify_text)(LEFT);
  1943.     (void) (*t->text_angle)(0);
  1944.     /* test tic size */
  1945.     (*t->move)(xmax/2+t->h_tic*2,0);
  1946.     (*t->vector)(xmax/2+t->h_tic*2,t->v_tic);
  1947.     (*t->move)(xmax/2,t->v_tic*2);
  1948.     (*t->vector)(xmax/2+t->h_tic,t->v_tic*2);
  1949.     (*t->put_text)(xmax/2+t->h_tic*2,t->v_tic*2+t->v_char/2,"test tics");
  1950.     /* test line and point types */
  1951.     x = xmax - t->h_char*4 - t->h_tic*4;
  1952.     y = ymax - t->v_char;
  1953.     for ( i = -2; y > t->v_char; i++ ) {
  1954.         (*t->linetype)(i);
  1955.         /*    (void) sprintf(label,"%d",i);  Jorgen Lippert
  1956.         lippert@risoe.dk */
  1957.         (void) sprintf(label,"%d",i+1);
  1958.         if ((*t->justify_text)(RIGHT))
  1959.             (*t->put_text)(x,y,label);
  1960.         else
  1961.             (*t->put_text)(x-strlen(label)*t->h_char,y,label);
  1962.         (*t->move)(x+t->h_char,y);
  1963.         (*t->vector)(x+t->h_char*4,y);
  1964.         if ( i >= -1 )
  1965.             (*t->point)(x+t->h_char*4+t->h_tic*2,y,i);
  1966.         y -= t->v_char;
  1967.     }
  1968.     /* test some arrows */
  1969.     (*t->linetype)(0);
  1970.     x = xmax/4;
  1971.     y = ymax/4;
  1972.     xl = t->h_tic*5;
  1973.     yl = t->v_tic*5;
  1974.     (*t->arrow)(x,y,x+xl,y,TRUE);
  1975.     (*t->arrow)(x,y,x+xl/2,y+yl,TRUE);
  1976.     (*t->arrow)(x,y,x,y+yl,TRUE);
  1977.     (*t->arrow)(x,y,x-xl/2,y+yl,FALSE);
  1978.     (*t->arrow)(x,y,x-xl,y,TRUE);
  1979.     (*t->arrow)(x,y,x-xl,y-yl,TRUE);
  1980.     (*t->arrow)(x,y,x,y-yl,TRUE);
  1981.     (*t->arrow)(x,y,x+xl,y-yl,TRUE);
  1982.     /* and back into text mode */
  1983.     (*t->text)();
  1984. }
  1985.  
  1986.  
  1987. #if defined(MSDOS)||defined(ATARI)||defined(OS2)||defined(_Windows)||defined(DOS386)
  1988. /* output for some terminal types must be binary to stop non Unix computers
  1989.    changing \n to \r\n. 
  1990.    If the output is not STDOUT, the following code reopens outfile 
  1991.    with binary mode. */
  1992. void
  1993. reopen_binary()
  1994. {
  1995. char filename[MAX_ID_LEN+1];
  1996.  
  1997.     if (outfile!=stdout) {
  1998.         (void) fclose(outfile);
  1999.         (void) strcpy(filename,outstr+1);    /* remove quotes */
  2000.         filename[strlen(filename)-1] = '\0';
  2001. #ifdef _Windows
  2002.         if ( !stricmp(outstr,"'PRN'") )
  2003.             (void) strcpy(filename,win_prntmp);    /* use temp file for windows */
  2004. #endif
  2005.         if ( (outfile = fopen(filename,"wb")) == (FILE *)NULL ) {
  2006.             if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
  2007.                 os_error("cannot reopen file with binary type; output unknown",
  2008.                     NO_CARET);
  2009.             } 
  2010.             else {
  2011.     os_error("cannot reopen file with binary type; output reset to ascii", 
  2012.                     NO_CARET);
  2013.             }
  2014.         }
  2015. #if defined(__TURBOC__) && defined(MSDOS)
  2016. #ifndef _Windows
  2017.         if ( !stricmp(outstr,"'PRN'") )
  2018.         {
  2019.         /* Put the printer into binary mode. */
  2020.         union REGS regs;
  2021.             regs.h.ah = 0x44;    /* ioctl */
  2022.             regs.h.al = 0;        /* get device info */
  2023.             regs.x.bx = fileno(outfile);
  2024.             intdos(®s, ®s);
  2025.             regs.h.dl |= 0x20;    /* binary (no ^Z intervention) */
  2026.             regs.h.dh = 0;
  2027.             regs.h.ah = 0x44;    /* ioctl */
  2028.             regs.h.al = 1;        /* set device info */
  2029.             intdos(®s, ®s);
  2030.         }
  2031. #endif
  2032. #endif
  2033.     }
  2034. }
  2035. #endif
  2036.  
  2037. #ifdef vms
  2038. /* these are needed to modify terminal characteristics */
  2039. #include <descrip.h>
  2040. #include <iodef.h>
  2041. #include <ttdef.h>
  2042. #include <tt2def.h>
  2043. #include <dcdef.h>
  2044. #include <ssdef.h>
  2045. #include <stat.h>
  2046. #include <fab.h>
  2047. static unsigned short   chan;
  2048. static int  old_char_buf[3], cur_char_buf[3];
  2049. $DESCRIPTOR(sysoutput_desc,"SYS$OUTPUT");
  2050.  
  2051. char *vms_init()
  2052. /*
  2053.  * Determine if we have a regis terminal
  2054.  * and save terminal characteristics
  2055. */
  2056. {
  2057.    /* Save terminal characteristics in old_char_buf and
  2058.    initialise cur_char_buf to current settings. */
  2059.    int i;
  2060.    sys$assign(&sysoutput_desc,&chan,0,0);
  2061.    sys$qiow(0,chan,IO$_SENSEMODE,0,0,0,old_char_buf,12,0,0,0,0);
  2062.    for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  2063.    sys$dassgn(chan);
  2064.  
  2065.    /* Test if terminal is regis */
  2066.    if ((cur_char_buf[2] & TT2$M_REGIS) == TT2$M_REGIS) return("regis");
  2067.    return(NULL);
  2068. }
  2069.  
  2070. void
  2071. vms_reset()
  2072. /* set terminal to original state */
  2073. {
  2074.    int i;
  2075.    sys$assign(&sysoutput_desc,&chan,0,0);
  2076.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
  2077.    for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  2078.    sys$dassgn(chan);
  2079. }
  2080.  
  2081. void
  2082. term_mode_tek()
  2083. /* set terminal mode to tektronix */
  2084. {
  2085.    long status;
  2086.    if (outfile != stdout) return; /* don't modify if not stdout */
  2087.    sys$assign(&sysoutput_desc,&chan,0,0);
  2088.    cur_char_buf[0] = 0x004A0000 | DC$_TERM | (TT$_TEK401X<<8);
  2089.    cur_char_buf[1] = (cur_char_buf[1] & 0x00FFFFFF) | 0x18000000;
  2090.  
  2091.    cur_char_buf[1] &= ~TT$M_CRFILL;
  2092.    cur_char_buf[1] &= ~TT$M_ESCAPE;
  2093.    cur_char_buf[1] &= ~TT$M_HALFDUP;
  2094.    cur_char_buf[1] &= ~TT$M_LFFILL;
  2095.    cur_char_buf[1] &= ~TT$M_MECHFORM;
  2096.    cur_char_buf[1] &= ~TT$M_NOBRDCST;
  2097.    cur_char_buf[1] &= ~TT$M_NOECHO;
  2098.    cur_char_buf[1] &= ~TT$M_READSYNC;
  2099.    cur_char_buf[1] &= ~TT$M_REMOTE;
  2100.    cur_char_buf[1] |= TT$M_LOWER;
  2101.    cur_char_buf[1] |= TT$M_TTSYNC;
  2102.    cur_char_buf[1] |= TT$M_WRAP;
  2103.    cur_char_buf[1] &= ~TT$M_EIGHTBIT;
  2104.    cur_char_buf[1] &= ~TT$M_MECHTAB;
  2105.    cur_char_buf[1] &= ~TT$M_SCOPE;
  2106.    cur_char_buf[1] |= TT$M_HOSTSYNC;
  2107.  
  2108.    cur_char_buf[2] &= ~TT2$M_APP_KEYPAD;
  2109.    cur_char_buf[2] &= ~TT2$M_BLOCK;
  2110.    cur_char_buf[2] &= ~TT2$M_DECCRT3;
  2111.    cur_char_buf[2] &= ~TT2$M_LOCALECHO;
  2112.    cur_char_buf[2] &= ~TT2$M_PASTHRU;
  2113.    cur_char_buf[2] &= ~TT2$M_REGIS;
  2114.    cur_char_buf[2] &= ~TT2$M_SIXEL;
  2115.    cur_char_buf[2] |= TT2$M_BRDCSTMBX;
  2116.    cur_char_buf[2] |= TT2$M_EDITING;
  2117.    cur_char_buf[2] |= TT2$M_INSERT;
  2118.    cur_char_buf[2] |= TT2$M_PRINTER;
  2119.    cur_char_buf[2] &= ~TT2$M_ANSICRT;
  2120.    cur_char_buf[2] &= ~TT2$M_AVO;
  2121.    cur_char_buf[2] &= ~TT2$M_DECCRT;
  2122.    cur_char_buf[2] &= ~TT2$M_DECCRT2;
  2123.    cur_char_buf[2] &= ~TT2$M_DRCS;
  2124.    cur_char_buf[2] &= ~TT2$M_EDIT;
  2125.    cur_char_buf[2] |= TT2$M_FALLBACK;
  2126.  
  2127.    status = sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2128.    if (status == SS$_BADPARAM) {
  2129.       /* terminal fallback utility not installed on system */
  2130.       cur_char_buf[2] &= ~TT2$M_FALLBACK;
  2131.       sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2132.    }
  2133.    else {
  2134.       if (status != SS$_NORMAL)
  2135.          lib$signal(status,0,0);
  2136.    }
  2137.    sys$dassgn(chan);
  2138. }
  2139.  
  2140. void
  2141. term_mode_native()
  2142. /* set terminal mode back to native */
  2143. {
  2144.    int i;
  2145.    if (outfile != stdout) return; /* don't modify if not stdout */
  2146.    sys$assign(&sysoutput_desc,&chan,0,0);
  2147.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
  2148.    for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  2149.    sys$dassgn(chan);
  2150. }
  2151.  
  2152. void
  2153. term_pasthru()
  2154. /* set terminal mode pasthru */
  2155. {
  2156.    if (outfile != stdout) return; /* don't modify if not stdout */
  2157.    sys$assign(&sysoutput_desc,&chan,0,0);
  2158.    cur_char_buf[2] |= TT2$M_PASTHRU;
  2159.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2160.    sys$dassgn(chan);
  2161. }
  2162.  
  2163. void
  2164. term_nopasthru()
  2165. /* set terminal mode nopasthru */
  2166. {
  2167.    if (outfile != stdout) return; /* don't modify if not stdout */
  2168.    sys$assign(&sysoutput_desc,&chan,0,0);
  2169.    cur_char_buf[2] &= ~TT2$M_PASTHRU;
  2170.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2171.    sys$dassgn(chan);
  2172. }
  2173.  
  2174. void
  2175. reopen_binary()
  2176. /* close the file outfile outfile and reopen it with binary type
  2177.    if not already done or outfile == stdout */
  2178. {
  2179.    stat_t stat_buf;
  2180.    char filename[MAX_ID_LEN+1];
  2181.    if (outfile != stdout) { /* don't modify if not stdout */
  2182.       if (!fstat(fileno(outfile),&stat_buf)) {
  2183.          if (stat_buf.st_fab_rfm != FAB$C_FIX) {
  2184.             /* modify only if not already done */
  2185.             (void) fclose(outfile);
  2186.             (void) strcpy(filename,outstr+1);   /* remove quotes */
  2187.             filename[strlen(filename)-1] = '\0';
  2188.             (void) delete(filename);
  2189.             if ((outfile = fopen(filename,"wb","rfm=fix","bls=512","mrs=512"))
  2190.                 == (FILE *)NULL ) {
  2191.                if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
  2192.                  os_error("cannot reopen file with binary type; output unknown",
  2193.                            NO_CARET);
  2194.                }
  2195.                else {
  2196.           os_error("cannot reopen file with binary type; output reset to ascii",
  2197.                            NO_CARET);
  2198.                }
  2199.             }
  2200.          }
  2201.       }
  2202.       else{
  2203.          os_error("cannot reopen file with binary type; output remains ascii",
  2204.                   NO_CARET);
  2205.       }
  2206.    }
  2207. }
  2208.  
  2209. void
  2210. fflush_binary()
  2211. {
  2212.    typedef short int INT16;     /* signed 16-bit integers */
  2213.    register INT16 k;            /* loop index */
  2214.    if (outfile != stdout) {
  2215.        /* Stupid VMS fflush() raises error and loses last data block
  2216.           unless it is full for a fixed-length record binary file.
  2217.           Pad it here with NULL characters. */
  2218.        for (k = (INT16)((*outfile)->_cnt); k > 0; --k)
  2219.           putc('\0',outfile);
  2220.        fflush(outfile);
  2221.    }
  2222. }
  2223. #endif
  2224.